思路逻辑
1.获取properties对象
2.获取java环境的相对路径
3.指定对应的properites文件
4.把文件变成流
5.properties对象加载流
public static Properties loadProp() {
Properties prop = new Properties();
String path = System.getProperty("user.dir");
File file = new File(path + "/conf/database.properties");
FileInputStream is = null;
try {
is = new FileInputStream(file);
prop.load(is);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return prop;
}