原文鏈接: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();
}
}