tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45285] New: RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED
Date Thu, 26 Jun 2008 06:58:29 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45285

           Summary: RESOURCES DECLARED IN PARENT CLASSES ARE NOT INJECTED
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: divanov@khmb.ru


According to the section EE.5.2.3 of the Java EE specification:
------------------------
Resource annotations may appear on any of the classes listed above, or on any
superclass of any class listed above. A resource annotation on any class in the
inheritance hierarchy defines a resource needed by the application component.
------------------------

I use JSF managed beans with @EJB annotated members.
If a resource is annotated in a super class of a class it's not injected.

Example:

public class Base{
@EJB
private SomeService service;
....
}

public class Child implements Base{
....
}

Base class used as managed bean has 'service' injected.
Child class used as managed bean does NOT have 'service' injected.

If I dare suggest the problem source ...

As I can see org.apache.catalina.util.DefaultAnnotationProcessor is used. It
has the following lines in its  'public void processAnnotations(Object
instance)' method:
....
Field[] fields = instance.getClass().getDeclaredFields();
....
Method[] methods = instance.getClass().getDeclaredMethods();
....


Class.getDeclaredFields method returns 'public, protected, default (package)
access, and private fields, but excludes inherited fields'.

The same thing is with Class.getDeclaredMethods.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message