0
点赞
收藏
分享

微信扫一扫

读取web应用中properties配置文件(这种方法可能不是最好的)

诗远 2023-04-12 阅读 113


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();
		}


  

举报

相关推荐

0 条评论