I have a singleton class which has been adopted so that the super method requires now an additional parameter, in my example it is set to foobar.
public class MySingleton extends MySystemLoader
{
private static final long serialVersionUID = -6053739985096001185L;
private static MySingleton SINGLETON = new MySingleton();
public static MySingleton getInstance() {
return SINGLETON;
}
private MySingleton() {
super( MySingleton.class, "foobar" );
}
}
My problem how can I inject this parameter to the this singleton class. The previous version of the private constructor looked like this
private MySingleton() {
super( MySingleton.class );
}
To be more concrete my app will run on a tomcat server and I want to inject the context name of my application into this singleton, because this will extract some configuration properties with this name and such stuff. Would be a context listener the right choice but also then how can i inject the context name into the singleton?