springtomcatspring-bootspring-restembedded-tomcat-8

Spring Boot 2.0.0.M6 and file upload more than 10 MB


To my Spring Boot 2.0.0.M6 application.properties I have added the following lines:

spring.http.multipart.max-file-size=100MB 
spring.http.multipart.max-request-size=100MB

but when I try to upload to my RestController the 21MB file it fails with the following exception:

Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (21112803) exceeds the configured maximum (10485760)

I run my application on Embedded Tomcat packaged with Spring Boot.

How to properly configure my application in order to allow file upload up to 100MB?


Solution

  • As shown in the documentation, and in its appendix, the correct properties are spring.servlet.multipart.max-file-size and spring.servlet.multipart.max-request-size.