public class ReadProperties{
private static String proFileName = "/config/MQSubjectId.properties";
private static Properties pro;
static{
try {
pro = new Properties();
InputStream in = ClassLoader.class.getResourceAsStream(proFileName);
pro.load(in);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
import java.util.Properties;
public class SystemVar {
private static Properties cache = new Properties();
static {
try {
cache.load(ClassLoader.class.getResourceAsStream("/config/systemConfig.properties"));
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getValue(String key){
return cache.getProperty(key);
}
public static void main(String[] args) {
System.out.println(getValue("environment"));
}
}