取配置文件properties

读取配置文件properties:

    

//加载
private static Properties srv = null;
	static {
		InputStream in = PlanStructForm.class.getClassLoader()
				.getResourceAsStream("srv.properties");//PlanStructForm 本类	
	srv= new Properties();
		try {
			srv.load(in);
			in.close();
			in = null;
		} catch (IOException e) {
			System.out.println("srv.properties not exist!!!");
		}
	}

 

//根据配置文件中的key值取得value值
private String serviceFilePath = srv.getProperty("srv.srvWholeFile");

 

//配置文件中的内容 srv.properties
srv.srvWholeFile = /srv/bidFile/wholeFile/

 

你可能感兴趣的:(properties)