[jboss-dev-forums] [Design of JBoss/Tomcat Integration] - JBAS-5673 - Metadata processing

emuckenhuber do-not-reply at jboss.com
Tue Aug 5 15:40:13 EDT 2008


Looking into https://jira.jboss.org/jira/browse/JBAS-5673, i noticed that something is missing in the web annotation processing with injection targets.

e.g. having 2 classes with the same EJB or Resource reference ends up in only one injection target for this reference:


  | public class FooServlet
  | {
  |     @EJB(beanName="StatefulTestBean", beanInterface=StatefulIF.class)
  |     private StatefulIF statefulTestBean;
  | }
  | public class Foo2Servlet
  | {
  |     @EJB(beanName="StatefulTestBean", beanInterface=StatefulIF.class)
  |     private StatefulIF statefulTestBean;
  | }
  | 

would result in a AnnotatedReferenceMetaData with one InjectionTarget, instead of two - which basically affects also @Resource, @PersistenceContext, @WebServiceRef processors. 

As it's currently done like (pseudocode):

  |    AnnotatedEJBReferenceMetaData ref = createAnnotatedEJBRef(...);
  |    ref.setInjectionTargets(injectionTargets);
  |    refs.add(ref);
  | 

So i guess it should rather be something like:

  |    AnnotatedEJBReferenceMetaData newRef = createAnnotatedEJBRef(...);
  |    AnnotatedEJBReferenceMetaData existingRef = refs.get(newRef.getName());
  |    if(existingRef == null)
  |       refs.add(ref);
  |    else
  |       mergeInjectionTargets(existingRef, newRef)
  | 
Or should this be done in a different way ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168828#4168828

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4168828



More information about the jboss-dev-forums mailing list