读取配置文件参数

时间秒杀一切 提交于 2019-12-30 02:16:49

配置文件代码:

 

java代码:

try{
     Properties prop = new Properties(); 
     //读取属性文件horizon.properties
     String params = request.getSession().getServletContext().getRealPath("/")+"WEB-INF\\workflow-conf\\properties\\horizon.properties";
     InputStream in = new BufferedInputStream (new FileInputStream(params));
     prop.load(in);     ///加载属性列表
     String basicVacationDay = prop.getProperty("basicVacationDay");
     String tallestVacationDay = prop.getProperty("tallestVacationDay");
     String base = prop.getProperty("base");
     in.close();
}catch(Exception e){
     e.printStackTrace();
}

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!