[size=medium]获得 .properties配置资源的方法
public void getpoperties(){
Properties prop = new Properties();
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("db.prooperties");
try{
prop.load(is);
this.driver = prop.getProperty("driver");
this.dburl = prop.getProperty("dburl");
this.dbuser = prop.getProperty("dbuser");
this.password = prop.getProperty("password");
}catch(IOException e){
e.printStackTrace();
}
}[/size]
public void getpoperties(){
Properties prop = new Properties();
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("db.prooperties");
try{
prop.load(is);
this.driver = prop.getProperty("driver");
this.dburl = prop.getProperty("dburl");
this.dbuser = prop.getProperty("dbuser");
this.password = prop.getProperty("password");
}catch(IOException e){
e.printStackTrace();
}
}[/size]
3581

被折叠的 条评论
为什么被折叠?



