I have set max file size to
multipart.maxFileSize: 1mb
multipart.maxRequestSize: 1mb
This is my controller :
@RequestMappi
Since @SeaBiscuit has provided the correct answer but with Spring boot 2.0.0.RELEASE
the class org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory has been removed and replaced by the class org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.
So the code for the new Spring boot 2.0.0 would be
@Configuration@Bean
public TomcatServletWebServerFactory containerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
@Override
public void customize(Connector connector) {
((AbstractHttp11Protocol>) connector.getProtocolHandler()).setMaxSwallowSize(-1);
}
});
return factory;
}
And if you've trouble configuring the maximum file upload size in Spring boot 2.0.0 put below code inside 'application.propertise' file with desired file size in 'MB's
## Image upload limitation properties
spring.servlet.multipart.max-file-size=3MB
spring.servlet.multipart.max-request-size=3MB