package cn.edu.hbcf.pojo;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
public class CustomizedPropertyConfigurer{
public static Object getContextProperty(String name) {
Map<String, Object> ctxPropertiesMap = new HashMap<String, Object>();
Properties prop = new Properties();
try {
InputStream in = CustomizedPropertyConfigurer.class.getClassLoader().getResourceAsStream("system.properties");
prop.load(in);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Iterator<String> it = prop.stringPropertyNames().iterator();
while(it.hasNext()){
String key = it.next();
String value = prop.getProperty(key);
System.out.println(key+":"+value);
ctxPropertiesMap.put(key, value);
}
return ctxPropertiesMap.get(name);
}
}