加载配置文件
//无法获取更新后的数据 -------是因为类装载器只装载一次 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");