Demo读取properties方式
1.
String p1 = Thread.currentThread().getContextClassLoader().getResource("").getPath()+"\\database.properties";
Properties p2 = new Properties();
FileReader fr = new FileReader(new File(p1));
p2.load(fr);
2.
Properties pro = new Properties();//database.properties
InputStream in = this.getClass().getClassLoader()
.getResourceAsStream("database.properties");
pro.load(in);
3.通过apache的组件
Configuration config = new PropertiesConfiguration("database.properties");