@Resource annotation in detail
I have looked through the Java EE 6 specification and have a few questions about the @Resource annotation.
Like many developers, I am quite comfortable with this usage:
<br /> @Resource<br /> private SomeConnectionFactory myCF;<br />
And I also understand the new-to-Java-EE "lookup" attribute:
<br /> @Resource(lookup = "java:app/env/TheFactory")<br /> private SomeConnectionFactory myCF;<br />
I realize I actually am drawing a blank on when one would actually use the "name" attribute:
<br /> @Resource(name = "something/relative/to/comp/env/perhaps/TheFactory")<br /> private SomeConnectionFactory myCF;<br />
I'm asking because (as many of you are painfully aware...sorry about that) I'm still trying to hook up my Drools resource adapter (which you'll recall, maybe, is inside an .ear file with my EJBs that use it).
I've created a connection pool, and a connection resource for my ResourceAdapter, and had to give it a name as part of the latter step. I chose "ra/RulesEngine". But of course my source code doesn't refer to "ra/RulesEngine" anywhere, and, I would think, nor should it.
I hope someone can point me at the obvious place I missed that gives a detailed rundown of how the @Resource annotation (in source code land) interacts with the application environment (in application server land).