时间:2021-06-28 08:27:50 | 栏目:JAVA代码 | 点击:次
如下所示:
public static String getConfig(String key) {
Properties pros = new Properties();
String value = "";
try {
pros.load(new InputStreamReader(Object.class.getResourceAsStream("/properties.properties"), "UTF-8"));
value = pros.get(key).toString();
} catch (IOException e) {
log.error(e.getMessage());
}
return value;
}