You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ApplicationScoped
public class Main
{
@Inject
private BeanManager beanManager;
public void init(@Observes ContainerInitialized event) throws NamingException
{
InitialContext ic = new InitialContext();
ic.bind("java:comp/env/BeanManager", beanManager);
BeanManager beanManager = (BeanManager) ic.lookup("java:comp/env/BeanManager");
System.out.println(beanManager.toString());
}
}
And it works as expected.
Now, instead of binding the beanManager in the Main class with ic.bind("java:comp/env/BeanManager", beanManager); I would like to do that in an according properties file. Is this possible? I found the examples for DataSources objects and the other Java types, but I'm a bit at loss at the moment. This is what I tried:
Should the env.properties file be created unter the config or under the config/java/comp folder?
What should the env.properties file look like?
BeanManager=? // I'm not sure how to get the injected object from above here - do I have to search for some kind of factory method within the weld library which I can state here?
BeanManager/type=javax.enterprise.inject.spi.BeanManager // If I understand correctly this is not supported
It would be great if you could give me some hints!
The text was updated successfully, but these errors were encountered:
Hello!
At the moment my project looks like this:
And it works as expected.
Now, instead of binding the
beanManager
in theMain
class withic.bind("java:comp/env/BeanManager", beanManager);
I would like to do that in an according properties file. Is this possible? I found the examples forDataSources
objects and the other Java types, but I'm a bit at loss at the moment. This is what I tried:Using the following
jndi.properties
:Should the
env.properties
file be created unter theconfig
or under theconfig/java/comp
folder?What should the
env.properties
file look like?It would be great if you could give me some hints!
The text was updated successfully, but these errors were encountered: