诗远

关注

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

诗远

关注

阅读 115

2023-04-12


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


  

相关推荐

归零者245号

读取java中的配置文件.properties

归零者245号 46 0 0

yeamy

文件写入的6种方法,这种方法性能最好

yeamy 84 0 0

大雁f

ResourceBundle 读取properties 配置文件

大雁f 66 0 0

janedaring

【Properties文件】Java使用Properties来读取配置文件

janedaring 151 0 0

张宏涛心理

你会几种读取/加载 properties配置文件方法

张宏涛心理 87 0 0

龙驹书房

使用InputStream流读取.properties配置文件

龙驹书房 60 0 0

北溟有渔夫

Shell 读取配置文件的方法

北溟有渔夫 156 0 0

大明宫

spark读取配置文件中的配置

大明宫 52 0 0

一只1994

【Java的Properties配置文件】

一只1994 88 0 0

爱我中华8898

在IDEA中创建properties配置文件

爱我中华8898 47 0 0

精彩评论(0)

0 0 举报