ResourceBundle rb = ResourceBundle.getBundle("dbcfg");
driverClass = rb.getString("driverClass");
System.out.println(driverClass);
url = rb.getString("url");
user = rb.getString("user");
password = rb.getString("password");
InputStream in = JdbcUtils.class.getClassLoader().getResourceAsStream("dbcfg.properties");
Properties pro = new Properties();
pro.load(in);
driverClass = pro.getProperty("driverClass");
url = pro.getProperty("url");
user = pro.getProperty("user");
password = pro.getProperty("password");
注意这两个用法的区别,一个直接用名字不带后缀名,一个要带后缀名