|
1
2
3
4
5
6
7
8
9
10
11
12 |
//无法获取更新后的数据 -------是因为类装载器只装载一次InputStream in
= Load.class.getClassLoader().getResourceAsStream("db.properties");Properties prop = new
Properties();prop.load(in);prop.get("url");//可以获取更新后的数据String path = Load.class.getClassLoader().getResource("db.properties").getPath();FileInputStream file = new
FileInputStream(path);Properties fileprop = new
Properties();fileprop.load(file);fileprop.get("url"); |
原文:http://www.cnblogs.com/keia/p/3590627.html