I have a java singleton class that has my application settings.
I used this approach: What is an efficient way to implement a singleton pattern in Java?
So I have:
public enum MySettings {
INSTANCE;
// bunch of private vars
private MySettings {
// load a json file and set my properties
JsonParser parser = jf.createJsonParser(new File("HARD_CODED_PATH_HERE"));
}
// public getters/setters here
}
So the problem is the hard coded path I have currently.
I created a settings.properties file in my /WEB-INF/ folder, now the problem is the only way I know how to load a properties file, it requires the servlet context:
Properties prop = new Properties();
propertiesload(getServletContext().....);
Is there another way to load this?
So is this properties file a static representation of the properties file? i.e. it is very fast and effecient?