读取web应用中properties配置文件(这种方法可能不是最好的)
String path= ContextLoader.getCurrentWebApplicationContext().getServletContext().getRealPath("/WEB-INF/spring/config.properties") ;
Properties p=new Properties();
try {
p.load(new FileInputStream(path));
System.out.println(p.getProperty("uploadPath"));
} catch (Exception e) {
e.printStackTrace();
}
posted on 2013-08-05 19:56 passer1991 阅读(206) 评论(0) 收藏 举报
浙公网安备 33010602011771号