package com.ssj.dubbo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

@Configuration
public class UploadConfiguration {

	  @Bean
	    public CommonsMultipartResolver multipartResolver() {
	        CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
	        commonsMultipartResolver.setMaxUploadSize(1024 * 1024 * 1024 * 2);
		    commonsMultipartResolver.setMaxInMemorySize(40960);
		    //commonsMultipartResolver.setResolveLazily(true);//resolveLazily属性启用是为了推迟文件解析，以在在UploadAction中捕获文件大小异常
	        commonsMultipartResolver.setDefaultEncoding("UTF-8");
	        return commonsMultipartResolver;
	    }
}
