场景

SpringBoot配置文件上传文件限制时提示:

Resolved [org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded; nested exception is java.lang.IllegalStateException:

org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.]

SpringBoot文件上传时提示FileUploadBase$SizeLimitExceed_spring

解决

Spring Boot 1.4以下

multipart.maxFileSize = 10Mb       //单个文件的大小
multipart.maxRequestSize=100Mb //单次请求的文件的总大小

Spring Boot1.4版本后

spring.http.multipart.maxFileSize = 10Mb 
spring.http.multipart.maxRequestSize=100Mb

Spring Boot2.0之后

spring.servlet.multipart.max-file-size=10000000
spring.servlet.multipart.max-request-size=100000000