|
@ -0,0 +1,27 @@
|
|
|
package com.yihu.jw.gateway.config;
|
|
|
|
|
|
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
import javax.servlet.MultipartConfigElement;
|
|
|
import java.io.*;
|
|
|
/**
|
|
|
* Created by liub on 2020/9/10.
|
|
|
*/
|
|
|
|
|
|
@Configuration
|
|
|
public class MultipartConfig {
|
|
|
@Bean
|
|
|
MultipartConfigElement multipartConfigElement() {
|
|
|
MultipartConfigFactory factory = new MultipartConfigFactory();
|
|
|
String location = "/data/apps/temp";
|
|
|
File tmpFile = new File(location);
|
|
|
if (!tmpFile.exists()) {
|
|
|
tmpFile.mkdirs();
|
|
|
}
|
|
|
factory.setLocation(location);
|
|
|
return factory.createMultipartConfig();
|
|
|
}
|
|
|
|
|
|
}
|