@Bean MultipartConfigElement multipartConfigElement() { MultipartConfigFactory factory = new MultipartConfigFactory(); factory.setMaxFileSize("10MB"); factory.setMaxRequestSize("10MB"); return factory.createMultipartConfig(); }
/** * Configure the {@link MultipartConfigFactory#setMaxFileSize(String)} and {@link * MultipartConfigFactory#setMaxRequestSize(String)} using a value of {@link * MainApp#MAXIMUM_FILE_SIZE}. * * @return The created {@link MultipartConfigElement} instance */ @Bean MultipartConfigElement multipartConfigElement() { MultipartConfigFactory factory = new MultipartConfigFactory(); factory.setMaxFileSize(MAXIMUM_FILE_SIZE); factory.setMaxRequestSize(MAXIMUM_FILE_SIZE); return factory.createMultipartConfig(); }
@Bean public MultipartConfigElement multipartConfigElement() { logger.info( "上传文件最大值:" + env.getProperty("file.maxFileSize") + "=======上传文件请求最大值:" + env.getProperty("file.maxRequestSize")); MultipartConfigFactory factory = new MultipartConfigFactory(); factory.setMaxFileSize(env.getProperty("file.maxFileSize")); factory.setMaxRequestSize(env.getProperty("file.maxRequestSize")); return factory.createMultipartConfig(); }