读取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 "";
}

}

孔曰成仁,孟曰取义
原文地址:https://www.cnblogs.com/haorun/p/6020331.html