加载properties文件的写法

来源:互联网 发布:企业网络系统建设方案 编辑:程序博客网 时间:2024/05/07 06:31
static{// //InputStream is = Thread.currentThread().getClass().getClassLoader().getResourceAsStream("db.properties");//Properties pro = new Properties();//try {//pro.load(is);//} catch (IOException e) {//e.printStackTrace();//}//DRIVER = pro.getProperty("driver");DRIVER = ResourceBundle.getBundle("db").getString("driver");URL = ResourceBundle.getBundle("db").getString("url");USERNAME = ResourceBundle.getBundle("db").getString("username");PASSWORD = ResourceBundle.getBundle("db").getString("password");}

0 0
原创粉丝点击