Spring Boot 批量上传异常: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field files exceeds its maximum permitted size of 1048576 bytes.
Spring Boot以Servlet 3 javax.servlet.http.Part API支持上传文件,对上传文件大小作了限制,可查看官方文档,如
解决方法,配置property参数,如
需要设置以下两个参数
multipart.maxFileSize
multipart.maxRequestSize
Spring Boot 1.3.x或者之前
multipart.maxFileSize=100Mb
multipart.maxRequestSize=1000Mb
Spring Boot 1.4.x或者之后
spring.http.multipart.maxFileSize=100Mb
spring.http.multipart.maxRequestSize=1000Mb
很多人设置了multipart.maxFileSize但是不起作用,是因为1.4版本以上的配置改了,详见官方文档:spring boot 1.4