public static String readValue(String fileName, String key) {
try {
Properties props = new Properties();
InputStream ips = CommonUtil.class.getClassLoader().getResourceAsStream(fileName);
if (ips == null) {
throw new RuntimeException("配置文件" + fileName + "不存在");
}
props.load(ips);
String value = props.getProperty(key);
System.out.println(key + "=" + value);
return value;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}