首页>代码>SpringBoot开发非常美观的java博客系统(包含后台管理功能)>/mblog/mblog-base/src/main/java/mblog/base/context/Global.java
package mblog.base.context;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import mblog.base.lang.Consts;
import mblog.base.utils.PropertiesLoader;
/**
* mblog 全局配置类
*/
public class Global {
/**
* 保存全局属性值
*/
private static ConcurrentMap<String, String> map = new ConcurrentHashMap<>();
/**
* 属性文件加载对象
*/
private static PropertiesLoader propertiesLoader = new PropertiesLoader(Consts.MTONS_CONFIG);
private static Boolean imageDomain = null;
private static String imageHost = null;
/**
* 获取配置
*/
public static String getConfig(String key) {
String value = map.get(key);
if (value == null){
value = propertiesLoader.getProperty(key);
map.put(key, value);
}
return value;
}
public static boolean getImageDomain() {
if (imageDomain == null) {
imageDomain = propertiesLoader.getBoolean("resource.domain", false);
}
return imageDomain;
}
public static String getImageHost() {
if (imageHost == null) {
imageHost = propertiesLoader.getProperty("resource.host");
}
return imageHost;
}
}
最近下载更多
vincemokea LV9
8月26日
lanhaigcb LV3
6月5日
032932 LV1
2月22日
srmess LV4
2024年12月30日
Duangi LV1
2024年12月23日
zolscy LV24
2024年12月18日
xianyu091012 LV5
2024年11月19日
12347658 LV1
2024年11月13日
xunxia LV7
2024年10月10日
微信网友_7005760998215680 LV6
2024年10月2日

最近浏览