multipart - CommonsMultipartResolver and spring session disturb each other -


there config of multi part config in spring boot

@bean public commonsmultipartresolver multipartresolver() { commonsmultipartresolver resolver = new commonsmultipartresolver(); resolver.setdefaultencoding("utf-8"); resolver.setmaxinmemorysize(20480); resolver.setmaxuploadsize(2048000000); return resolver; } 

it right , work successfully,when below dependency added

           <dependency>                 <groupid>org.springframework.session</groupid>                 <artifactid>spring-session</artifactid>             </dependency> 

the below exception raised:

[error] org.springframework.web.multipart.support.missingservletrequestpartexception: required request part 'file' not present required request part 'file' not present

where wrong?

edit:

related controller:

@requestmapping(value={"/save"}, method={org.springframework.web.bind.annotation.requestmethod.post})   @responsebody   public fileproviderdto save(@requestparam("file") multipartfile file, @requestparam string filecode)      throws ioexception, sqlexception    { 

i add config , work correctly.

@bean public commonsmultipartresolver multipartresolver() {     commonsmultipartresolver resolver = new commonsmultipartresolver();     resolver.setdefaultencoding("utf-8");     resolver.setmaxinmemorysize(20480);     resolver.setmaxuploadsize(2048000000);     return resolver; }  @bean @order(0) public multipartfilter multipartfilter() {     multipartfilter multipartfilter = new multipartfilter();     multipartfilter.setmultipartresolverbeanname("multipartresolver");     return multipartfilter; } 

and skip multipartautoconfiguration.class this:

@springbootapplication(exclude = { multipartautoconfiguration.class }) 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -