读取Properties键值对

public class CommonFunc {

/**
* 取properties文件中的键值对
*/
public static String getProperties(String param) throws Exception {

Properties prop = new Properties();
InputStream in = Object.class.getResourceAsStream("/jdbc.properties");
try {
prop.load(in);
return prop.getProperty(param).trim();
} catch (IOException e) {
e.printStackTrace();
}
return "";
}

}

 

 

posted @ 2016-11-01 17:38  1582277142  阅读(1267)  评论(0编辑  收藏  举报