方法一:
Properties prop = new Properties();//属性集合对象
FileInputStream fis = new FileInputStream("D:\\db.properties");//属性文件流
prop.load(fis);//将属性文件流装载到Properties对象中
String DB_URL= prop.getProperty("oracleurl");
String DB_DRIVER=prop.getProperty("oracledriver");
String DB_USERNAME=prop.getProperty("oracleuser");
String DB_PASSWORD=prop.getProperty("oraclepassword");
方法二:
ResourceBundle bundle = ResourceBundle.getBundle("payment");//读取payment.properties
String securityUtilPrivateKey = bundle.getString("securityUtilPrivateKey")