public static String readProperties(String key) {
String value= null;
try {
Properties properties = new Properties();
// 使用ClassLoader加载properties配置文件生成对应的输入流
InputStream in = UrlPage.class.getClassLoader().getResourceAsStream("config.properties");
// 使用properties对象加载输入流
properties.load(in);
//获取key对应的value值
value = properties.getProperty(key);
} catch (IOException e) {
e.printStackTrace();
}
return value;
}