use of org.springframework.boot.web.servlet.MultipartConfigFactory in project spring-boot by spring-projects.
the class MultipartProperties method createMultipartConfig.
/**
* Create a new {@link MultipartConfigElement} using the properties.
* @return a new {@link MultipartConfigElement} configured using there properties
*/
public MultipartConfigElement createMultipartConfig() {
MultipartConfigFactory factory = new MultipartConfigFactory();
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this.fileSizeThreshold).to(factory::setFileSizeThreshold);
map.from(this.location).whenHasText().to(factory::setLocation);
map.from(this.maxRequestSize).to(factory::setMaxRequestSize);
map.from(this.maxFileSize).to(factory::setMaxFileSize);
return factory.createMultipartConfig();
}
use of org.springframework.boot.web.servlet.MultipartConfigFactory in project sinsim by WilsonHu.
the class FileUploadConfig method multipartConfigElement.
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
// 设置文件大小限制 ,超出设置页面会抛出异常信息,
// 这样在文件上传的地方就需要进行异常信息的处理了;
// KB,MB
factory.setMaxFileSize("10MB");
// / 设置总上传数据总大小
factory.setMaxRequestSize("100MB");
// factory.setLocation("路径地址");
return factory.createMultipartConfig();
}
use of org.springframework.boot.web.servlet.MultipartConfigFactory in project alien4cloud by alien4cloud.
the class Bootstrap method multipartConfigElement.
@Bean
public MultipartConfigElement multipartConfigElement(@Value("${upload.max_archive_size}") long maxUploadSize) {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setMaxRequestSize(maxUploadSize);
factory.setMaxFileSize(maxUploadSize);
return factory.createMultipartConfig();
}
use of org.springframework.boot.web.servlet.MultipartConfigFactory in project Spring-Family by Sierou-Java.
the class CommonConfig method multipartConfigElement.
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setMaxFileSize(1024L * 1024L * Integer.parseInt(UploadUtils.maxSize));
return factory.createMultipartConfig();
}
Aggregations