public static String getProperty(String file, String key) {
InputStream in = ReserviceInterface.class.getClassLoader().getResourceAsStream(file);
Properties pro = new Properties();
String result = "";
try {
pro.load(in);
result = pro.getProperty(key);
//System.out.println(result);
} catch(IOException e) {
//System.out.println("读取文件出错");
e.printStackTrace();
return null;
}
finally{
if(in != null) {
try {
in.close();
} catch (Exception e) {
}
}
}
return result;
}
路径配置化
最新推荐文章于 2022-10-23 11:18:50 发布