The multi-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector.
Refer to this link: http://stackoverflow. com/questions/33232849/increase-http-post-maxpostsize-in-spring-boot
needs to modify the following two configurations at the same time:
1. Modify maxPostSize, it seems that it can only be done in the code:
@Bean EmbeddedServletContainerCustomizer containerCustomizer() throws Exception { return (ConfigurableEmbeddedServletContainer container) -> { if (container instanceof TomcatEmbeddedServletContainerFactory) { TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container; tomcat.addConnectorCustomizers((connector) -> { connector.setMaxPostSize(10000000); // 10 MB }); } };
2. Modify the size limit of multipartFile, either in the code or in the configuration file:
spring: http: multipart: max-file-size: 10MB max-request-size: 10MB maxFileSize: 10MB maxRequestSize: 10MB