45 lines
1.1 KiB
Java
45 lines
1.1 KiB
Java
package com.evo.common.config;
|
|
|
|
import com.evo.common.utils.spring.SpringUtils;
|
|
import lombok.Data;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
/**
|
|
* 全局属性配置
|
|
* @author andy.shi
|
|
* @ClassName:Global
|
|
* @date: 2026年01月10日 10:16
|
|
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
|
*/
|
|
@Configuration
|
|
@ConfigurationProperties //(prefix = "yt", ignoreInvalidFields = true)
|
|
@Data
|
|
public class Global {
|
|
/***
|
|
* 云平台私钥
|
|
*/
|
|
@Value("${spring.profiles.active}")
|
|
public String active;
|
|
//单例模式全局属性
|
|
private static volatile Global global;
|
|
|
|
|
|
public static Global newInstance() {
|
|
if(global == null){
|
|
synchronized (Global.class){
|
|
if(global == null){
|
|
global = SpringUtils.getBean(Global.class);
|
|
}
|
|
}
|
|
}
|
|
return global;
|
|
}
|
|
|
|
// public String getActive() {
|
|
// return active;
|
|
// }
|
|
|
|
}
|