I’m trying to load bean runtime configuration.
@Stateless
public class MyBean implements MyLocal{
@Resource String runtimeSetting1="default_value";
//....
}
I cannot find out how to create custom resource on app server side (Glassfish) – I have no idea what I should enter in “Factory Class” field.
Maybe there is a better way of loading configuration…
Thanks.
To my knowledge, the standard way in Java EE is to declare
env-entryfor configuration data. This applies to all Java EE components like EJB 3 bean class, servlet, filters, interceptors, listener classes, etc. Here, declare something like this in yourejb-jar.xml:Then look up the env-entry with JNDI or inject it by its name. For example, to inject it in your bean: