This content has been marked as final.
Show 2 replies
-
1. Re: Inject custom resource with @Resource
jaikiran Feb 25, 2011 3:47 AM (in response to stianst)You can do that as long as MyResource is bound somewhere in the JNDI of the server. The injection into EJB is done by picking up the objects from the JNDI. So if your MyResource is available at "Blah" jndi-name for example, then you can do:
@Resource (name = "someName", mappedName="Blah") private MyResource myResource;
-
2. Re: Inject custom resource with @Resource
stianst Feb 25, 2011 4:39 AM (in response to jaikiran)Thanks - got that working. What jndi-name would I have to bind it to if I don't want to specify the mappedName:
{code}
@Resource
private MyResource myResource;
{code}