文件上传配置
/**
* 文件上传配置
*/
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
// 单个文件最大
// factory.setMaxFileSize("100MB"); // KB,MB
// 209715200l = 200M
// 1048576000l = 1000M
factory.setMaxFileSize(DataSize.ofBytes(1048576000l));
// 设置总上传数据总大小
// factory.setMaxRequestSize("1000MB");
factory.setMaxRequestSize(DataSize.ofBytes(1048576000l));
return factory.createMultipartConfig();
}
不安全的HTTP方法
@Bean
public ConfigurableServletWebServerFactory configurableServletWebServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addContextCustomizers(context -> {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
collection.addMethod("HEAD");
collection.addMethod("PUT");
collection.addMethod("DELETE");
collection.addMethod("TRACE");
collection.addMethod("COPY");
collection.addMethod("SEARCH");
collection.addMethod("PROPFIND");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
});
return factory;
}