package com.zeshang.utils;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import java.util.Properties;
@Data
@Configuration
public class YmlConfig {
@Value("${file.upload-path}")
private String uploadPathLinux;
@Value("${file.upload-path-win}")
private String uploadPathWin;
@Value("${file.request-domain}")
private String requestDomainLinux;
@Value("${file.request-domain-win}")
private String requestDomainWin;
@Value("${file.access-path}")
private String accessPath;
public String getUploadPath(){
Properties osPro=System.getProperties();
String os=osPro.getProperty("os.name");
if(os.startsWith("Win")){
return uploadPathWin;
}else{
return uploadPathLinux;
}
}
public String getRequestDomain(){
Properties osPro=System.getProperties();
String os=osPro.getProperty("os.name");
if(os.startsWith("Win")){
return requestDomainWin;
}else{
return requestDomainLinux;
}
}
}
server:
tomcat:
uri-encoding: UTF-8
threads:
max: 1000
min-spare: 30
port: 8083
servlet:
context-path: /english
session:
cookie:
http-only: true
file:
#文件上传位置
upload-path: /home/student/upload/
#文件访问地址
access-path: /file