为什么之前的值能取出来 新加的取出是空 需要刷新么 都是getProperties(“key”)取得?
配置文件读取的话:
<context:property-placeholder location="classpath:jdbc.properties"/>
java读取:
private static String confile = "jdbc.properties";
private static Properties p = null;
tatic {
InputStream inputStream = null;
try {
p = new Properties();
confile = DBHelper.class.getClassLoader().getResource("").getPath() + confile;
File file = new File(confile);
inputStream = new BufferedInputStream(new FileInputStream(file));
p.load(inputStream);
Class.forName(p.getProperty("driver"));
} catch (Exception e) {
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}