SpringBoot设置MultipartFile文件大小限制
原文链接:https://blog.csdn.net/qq_36514766/article/details/102500310
package com.gdd.videos.mini_api.common;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
import javax.servlet.MultipartConfigElement;
import java.io.IOException;
/**
* @author zhangh
* @version V1.0.0
* @projectName parent
* @title IndexSwaggerConfig
* @package com.gdd.videos.mini_api.common
* @date 2019/9/11 15:19
* @explain 项目启动时默认打开swagger页面
*/
@Configuration
public class IndexSwaggerConfig {
/**
* 配置文件上传大小
*/
@Bean
public MultipartConfigElement multipartConfigElement(){
MultipartConfigFactory factory = new MultipartConfigFactory();
// 单个数据大小 10M
factory.setMaxFileSize("10240KB");
/// 总上传数据大小 10M
factory.setMaxRequestSize("10240KB");
return factory.createMultipartConfig();
}
}
相关文章
- SpringBoot使用swagger2构建API文档
- springboot启动报错:“Error starting ApplicationContext. To display the conditions report re-run your appl
- SpringBoot项目实现Docker部署
- springboot程序无法访问静态资源
- spring,springmv,springboot解决跨域问题
- 【SpringBoot 一】SpringApplication启动类的Args详解
- springboot配置mybatis
- 基于Springboot+Vue+H5实现MiniTalk聊天APP
- springBoot 自动装配,SpringBoot自动配置,SpringBoot自动加载
- java jwt使用,springboot 整合java-jwt,java jwt工具类
- Java返回结果封装,SpringBoot返回结果封装
- Java学习-089-springboot 通过 Spring Initializr 创建服务及IDEA导入后配置更新示例
- Springboot输出自定义注释logo
- Springboot应用中过滤器chain.doFilter后设置header无效
- springboot 设置web和非web启动
- SpringBoot设置项目欢迎页面与自定义Favicon图标
- Spring中Bean的加载与SpringBoot的初始化流程详解
- SpringBoot如何使用Slf4j日志与logback-spring.xml配置详解
- springboot-集成MySQL+druid+mybatis-plus总结
- springboot+vue在线动漫信息平台(源码+文档)
- 解决SpringBoot跨域的三种方式
- Springboot +mybatis-plus 实现代码生成器(自定义默认模板引擎)
- SpringBoot 整合实现RabbitMQ
- SpringBlade 找不到或无法加载主类 springboot.Application
- SpringBoot设置全局上传文件路径并上传文件
- SPRINGBOOT配置MYSQL,MYBATIS,DRUID