[jboss-dev] Papaki Annotation Scanning Requirements

Jason T. Greene jason.greene at redhat.com
Thu Nov 12 16:47:32 EST 2009


Rémy Maucherat wrote:
> On Wed, Nov 11, 2009 at 5:37 PM, Jason T. Greene
> <jason.greene at redhat.com> wrote:
>> This, however, only happens when you have a beans.xml. If there is no
>> beans.xml, then 299 does no scanning.
> 
> Are you sure ? In Servlet 3.0, the language to skip resource injection
> in some cases is about managed beans (greatly expanded in JSR 299),
> not if a particular object is enabled in JSR 299 (or whatever the spec
> defines). So I would prefer scanning and processing annotations all
> the time.

If there is no beans.xml, then no 299 specific types are searched for 
(299 style managed beans, stereotypes, decorators, etc) in the deployment.

Servlets and EJBs in a deployment without a beans.xml can still use 
injection; however, only beans which are in a deployment that  does 
contain a beans.xml are injectable (and such deployments must be 
"visible" [in the classpath via ear, web-inf/lib, etc]). There is one 
exception which is @New, which just creates a new instance per injection 
point, and that can be resolved lazily.

Stated differently, if there is no beans.xml, then only reflective 
analysis of the EE component being instantiated need be done. This is 
basically the same rules as EE injection. So if metadata-complete is 
true in the ejb or war case, and there is no beans.xml, then no 
searching needs to be done. Reflection will still need to be done on 
each class specified in the descriptor.

-- 
Jason T. Greene
JBoss, a division of Red Hat



More information about the jboss-development mailing list