/**
* 得到属性文件信息
*
* @param key
* @return
*/
public static String getPropertiesByKey(String key) {
InputStream in=null;
try {
in = new ToolsClass().getClass().getResourceAsStream(
"/jajnInfo.properties");
Properties xie = new Properties();
xie.load(in);// 加载数据流
return xie.getProperty(key);
} catch (Exception e) {
e.printStackTrace();
return null;
}
finally{
if(null!=in)
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
使用getPropertiesByKey(key关键字); 如: getPropertiesByKey("mail.smtp.host");

来源:https://www.cnblogs.com/W203654/p/3772771.html
