springboot上传大文件报错
2018-03-08 00:14
330 查看
the request was rejected because its size (48376267) exceeds the configured
配置文件已配置以下属性,但报错依然
spring.http.multipart.maxFileSize=1000Mb spring.http.multipart.maxRequestSize=1000Mb
故使用另一种方法,在启动类中注入:
import javax.servlet.MultipartConfigElement; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.embedded.MultipartConfigFactory; import org.springframework.context.annotation.Bean; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, new String[] { "--debug" }); } /** * 设置上传文件大小,配置文件属性设置无效 * * @author 空空dream * @date 2018年3月8日 */ @Bean public MultipartConfigElement multipartConfigElement() { MultipartConfigFactory config = new MultipartConfigFactory(); config.setMaxFileSize("9000MB"); config.setMaxRequestSize("9000MB"); return config.createMultipartConfig(); } }
继续上传大文件,不再报错。
相关文章推荐
- SpringBoot下文件上传与下载的实现
- SpringBoot文件上传下载和多文件上传(图文详解)
- 企业级 SpringBoot 教程 (十七)上传文件
- SpringBoot非官方教程 | 第十七篇:上传文件
- springboot上传文件
- Springboot 文件上传
- springboot上传文件(存入服务器,并将URL存入数据库表中)
- SpringBoot实现文件上传
- Springboot单文件上传大小限制 FileUploadBase$FileSizeLimitExceededException:
- springboot设置上传文件大小的方式(两种)
- SpringBoot下文件上传与下载的实现
- Angular14 利用Angular2实现文件上传的前端、利用springBoot实现文件上传的后台
- SpringBoot限制文件或图片上传大小的两种配置方法
- SpringBoot实现文件上传下载功能小结
- SpringBoot文件上传大小设置问题
- SpringBoot上传文件
- SpringBoot上传文件到本服务器 目录与jar包同级
- springboot 设置文件可上传的大小
- Springboot 文件上传(带进度条)
- springBoot上传文件大小设置