public class Config {
private static PropertiesConfiguration propConfig;
private static final Config CONFIG = new Config();
/**
* 自动保存
*/
private static boolean autoSave = true;
private Config() {
}
public static Config getInstance(String propertiesFile) {
//执行初始化
init(propertiesFile);
return CONFIG;
}
/**
* 初始化
*
* @param propertiesFile
* @see
*/
private static void init(String propertiesFile) {
try {
propConfig = new PropertiesConfiguration(propertiesFile);
//自动重新加载
propConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
//自动保存
propConfig.setAutoSave(autoSave);
} catch (ConfigurationException e) {
e.printStackTrace();
}
}
/**
* 根据Key获得对应的value
*
* @param key
* @return
* @see
*/
public Object getValue(String key) {
return propConfig.getProperty(key);
}
/**
* 设置属性
*
* @param key
* @param value
* @see
*/
public void setProperty(String key, String value) {
propConfig.setProperty(key, value);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有