一、错误原因:文件大小超过SpringBoot的默认限制
二、解决方案:修改配置
spring:
servlet:
multipart:
# 最大支持文件大小
max-file-size: 100MB
# 最大支持请求大小
max-request-size: 100MB
三、错误展示
3.1、服务端错误打印
errorHandler: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 (14983238) exceeds the configured maximum (10485760)
3.2、postman错误
{
"code": 9001,
"msg": "请求处理失败!",
"data": "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 (14983238) exceeds the configured maximum (10485760)"
}
注:以上内容仅提供参考和交流,请勿用于商业用途,如有侵权联系本人删除!
|