#20230529 欣影管理平台拍照时间表代码
parent
103dedcdd6
commit
08b235ad57
@ -0,0 +1,30 @@
|
||||
package com.shxy.xymanager_common.bean;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class MultipartConfig {
|
||||
@Value("${spring.servlet.multipart.location}")
|
||||
private String fileTempDir;
|
||||
|
||||
@Bean
|
||||
MultipartConfigElement multipartConfigElement() {
|
||||
String os = System.getProperty("os.name");
|
||||
// 兼容windows
|
||||
if(os.toLowerCase().startsWith("win")){
|
||||
fileTempDir = "C:" + fileTempDir;
|
||||
}
|
||||
log.info("fileTempDir:{}", fileTempDir);
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
factory.setLocation(fileTempDir);
|
||||
return factory.createMultipartConfig();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue