package com.yrl.common.constant;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;
public class ConfigConstant {
private static Map<String,String> valueMap = new HashMap<>();
static {
ResourceBundle ct = ResourceBundle.getBundle("ct");
Enumeration<String> keys = ct.getKeys();
while (keys.hasMoreElements()){
String key = keys.nextElement();
String value = ct.getString(key);
valueMap.put(key,value);
}
}
public static String getVal(String key){
return valueMap.get(key);
}
public static void main(String[] args) {
String val = getVal("ct.cf.caller");
System.out.println(val);
}
}
通用配置文件读取
最新推荐文章于 2024-09-03 20:17:53 发布