修改springboot内置tomcat上传文件的大小参数
https://blog.csdn.net/persistencegoing/article/details/84376427报错Maximum upload size exceededthe request was rejected because its size (9739444) exceeds the configured maximum (5242880)上传大小超出限...
·
https://blog.csdn.net/persistencegoing/article/details/84376427
报错
Maximum upload size exceeded
the request was rejected because its size (9739444) exceeds the configured maximum (5242880)
上传大小超出限制,springboot默认上传大小小于1M
修改Spring Boot内置Tomcat的maxPostsize值,在application.yml配置文件中添加以下内容:
server:
tomcat:
max-http-post-size: -1
或者properties中
server.tomcat.max-http-post-size=-1
再配置服务的
multipart.maxFileSize=150MB multipart.maxRequestSize=150MB
在启动类中加入
@Bean
public MultipartConfigElement multipartConfigElement(@Value("${multipart.maxFileSize}")String maxFileSize, @Value("${multipart.maxRequestSize}") String maxRequestSize) {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setMaxFileSize(maxFileSize);
factory.setMaxRequestSize(maxRequestSize);
return factory.createMultipartConfig();
}
搞定
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)