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;
    }
}

 

posted @ 2018-04-24 09:32  劈天造陆  阅读(2377)  评论(0编辑  收藏  举报