Java中SpringBoot上传文件时报错:org.springframework.web.multipart.MaxUploadSizeExceededException

完整报错信息:

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

org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException: the request was rejected because its size (803477000) exceeds the configured maximum (20971520)

原因:文件上传大小超出配置文件中的限制

解决方案:修改配置文件

找到配置中的spring:servlet:multipart下的文件大小配置,修改为大于你文件大小的值即可。