java readProperties

时间:2023-03-08 22:08:52
@Deprecated
public static Map<String, String> readProperties(String propertiesFile) {
Properties prop = new Properties();
try {
prop.load(new InputStreamReader(
App.class.getClassLoader().getResourceAsStream(propertiesFile + ".properties"), UTF8));
} catch (Exception ex) {
throw SystemException.wrap(ex);
} Map<String, String> map = new HashMap<>();
for (String key : prop.stringPropertyNames()) {
map.put(key, isNull(prop.getProperty(key), ""));
}
return map;
}