I have a controller with a MultipartConfig
annotation (a snippet of which is show below):
@RestController
@RequestMapping(\"packages\")
@MultipartCo
With Spring Boot 2.0, you should use this in your application.yml
spring:
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
From documentation:
Spring Boot embraces the Servlet 3
javax.servlet.http.Part
API to support uploading files. By default, Spring Boot configures Spring MVC with a maximum size of 1MB per file and a maximum of 10MB of file data in a single request. You may override these values, the location to which intermediate data is stored (for example, to the/tmp
directory), and the threshold past which data is flushed to disk by using the properties exposed in theMultipartProperties
class. For example, if you want to specify that files be unlimited, set the spring.servlet.multipart.max-file-size property to-1
.
Extracted from Appendix A of documentation
spring.servlet.multipart.max-file-size=1MB # Max file size. Values can use the suffixes "MB" or "KB" to indicate megabytes or kilobytes, respectively.
spring.servlet.multipart.max-request-size=10MB # Max request size. Values can use the suffixes "MB" or "KB" to indicate megabytes or kilobytes, respectively.