背景
有一个上传文件接口,在其他项目运行正常
@PostMapping("/upload")
public String upload(@RequestParam("file") MultipartFile file, @RequestParam("orgId") Integer orgId) {
return file.getName() + " " + file.getSize() + " ";
}
问题
迁移到springboot1.5.4后提示文件超出1M,根本就进入不了controller的upload方法
解决
修改配置文件application.properties,增加2个配置项
spring.http.multipart.maxFileSize=100Mb
spring.http.multipart.maxRequestSize=1000Mb