users@glassfish.java.net

Re: How does Glassfish @EJB find local references?

From: <forums_at_java.net>
Date: Fri, 26 Aug 2011 11:55:15 -0500 (CDT)

I would not recommend implementing your own annotation handling for @EJB. 
It's not hard to handle it for common cases, but not maitainable when it
comes to not so common cases, xml overriding, etc.  Just use the simple look
up.

If you do need to, one approach is to inspect @EJB (class-level,
method-level, and field-level), gather all attributes.  For optional
attributes, check its context like setter param type, field type to infer
it's business interface, then scan your app for the target EJB that
implementing that business interface.  Once you have app-name, module-name,
bean-name, business interface, then construct its portable global jndi name
to look it up.  You may want to impose some rules on the acceptable use of
@EJB in your project to simplify processing.


--
[Message sent by forum member 'cf126330']
View Post: http://forums.java.net/node/837497