I use xml config spring4 is work well.like this:
From MultipartResolver
Javadoc : To define an implementation, create a bean with the id "multipartResolver" in a DispatcherServlet's application context.
In your xml configuration, the bean has the correct id of multipartResolver
, but not in your current java configuration. You should write :
@Bean
public CommonsMultipartResolver multipartResolver() {
CommonsMultipartResolver resolver=new CommonsMultipartResolver();
resolver.setDefaultEncoding("utf-8");
return resolver;
}
or
@Bean(name = "multipartResolver")
public CommonsMultipartResolver createMultipartResolver() {
CommonsMultipartResolver resolver=new CommonsMultipartResolver();
resolver.setDefaultEncoding("utf-8");
return resolver;
}