The main function of the Spring component Commonsmultipartresolver class is to configure some properties of the file upload, or to control the size of the uploaded file.
In the Springmvc-servlet.xml configuration file:
<BeanID= "Multipartresolver"class= "Org.springframework.web.multipart.commons.CommonsMultipartResolver">< Propertyname= "Defaultencoding">
<!--encoding --<value>UTF-8</value></ Property>< Propertyname= "Maxuploadsize">
<!--The maximum value of the uploaded file, such as within 20M limit: 20*1024*1024=52428800 --<value>52428800</value></ Property>
<!--cache size -< Propertyname= "Maxinmemorysize"><value>4096</value></ Property></Bean>
The ID of the generic bean is only used as a unique identifier, but here you have to make sure that the ID is multipartresolver, and the others are Localeresolver, themeresolver, and so on.
Why fixed ID?
The reason is that the ID of these beans is fixed in the core class dispatcherservlet of SPRINGMVC. The code is as follows:
Public class extends Frameworkservlet { publicstaticfinal String multipart_resolver_bean_name = "Multipartresolver"; Public Static Final String locale_resolver_bean_name = "Localeresolver"; Public Static Final String theme_resolver_bean_name = "Themeresolver";
Later, if the configuration is normal but does not work, you can go to Dispatcherservlet to see if the ID is fixed.
SPRINGMVC Learning-Uploading a file decomposition Commonsmultipartresolver class