Springboot配置文件解析器

@EnableScheduling
@MapperScan(value = "com.****.dao")
@EnableTransactionManagement
@EnableAutoConfiguration(exclude = { MultipartAutoConfiguration.class })
@EnableAsync
@SpringBootApplication
public class CispHistoryApplication {

    public static void main(String[] args) {
        SpringApplication.run(CispHistoryApplication.class, args);
    }

    // 显示声明CommonsMultipartResolver为mutipartResolver
    @Bean(name = "multipartResolver")
    public MultipartResolver multipartResolver() {
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
        resolver.setDefaultEncoding("UTF-8");
        resolver.setResolveLazily(true);// resolveLazily属性启用是为了推迟文件解析,以在在UploadAction中捕获文件大小异常
        resolver.setMaxInMemorySize(40960);
        resolver.setMaxUploadSize(5 * 1024 * 1024 * 1024);// 上传文件大小 5G
        return resolver;
    }
}

 

转载于:https://www.cnblogs.com/java-spring/p/8926274.html

你可能感兴趣的:(Springboot配置文件解析器)