Skip to content

Commit

Permalink
springboot临时目录被操作系统清理问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
sanluan committed Jan 10, 2019
1 parent cb4aade commit 7d7c33c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package config.spring;

import static config.initializer.InitializationInitializer.CMS_CONFIG_FILE;
import static org.publiccms.common.constants.CommonConstants.CMS_FILEPATH;
import static java.lang.Integer.parseInt;
import static org.publiccms.common.constants.CommonConstants.CMS_FILEPATH;
import static org.publiccms.common.database.CmsDataSource.DATABASE_CONFIG_FILENAME;
import static org.springframework.core.io.support.PropertiesLoaderUtils.loadAllProperties;
import static org.springframework.scheduling.quartz.SchedulerFactoryBean.PROP_THREAD_COUNT;
Expand Down Expand Up @@ -33,6 +33,7 @@
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.core.env.Environment;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
Expand Down Expand Up @@ -266,12 +267,14 @@ public SchedulerFactoryBean scheduler() {
* File Upload Resolver
*
* @return
* @throws IOException
*/
@Bean
public CommonsMultipartResolver multipartResolver() {
public CommonsMultipartResolver multipartResolver() throws IOException {
CommonsMultipartResolver bean = new CommonsMultipartResolver();
bean.setDefaultEncoding(DEFAULT_CHARSET_NAME);
bean.setMaxUploadSize(Long.parseLong(env.getProperty("cms.multipart.maxUploadSize")));
bean.setUploadTempDir(new FileSystemResource(getDirPath("/temp/")));
return bean;
}

Expand Down

0 comments on commit 7d7c33c

Please sign in to comment.