ResourceBundle 读取properties 配置文件
程序员文章站
2022-04-25 13:33:53
...
读取写入 map中
HashMap map = new HashMap();
ResourceBundle bundle = ResourceBundle.getBundle(resourceFileName);
java.util.Enumeration enums = bundle.getKeys();
while (enums.hasMoreElements()) {
String key = (String) enums.nextElement();
String value = bundle.getString(key);
map.put(key, value);
}
return map;
HashMap map = new HashMap();
ResourceBundle bundle = ResourceBundle.getBundle(resourceFileName);
java.util.Enumeration enums = bundle.getKeys();
while (enums.hasMoreElements()) {
String key = (String) enums.nextElement();
String value = bundle.getString(key);
map.put(key, value);
}
return map;