4 Replies Latest reply on Jun 8, 2009 12:34 PM by Kai Hennig

    How to get access to injected components from inner classes?

    Kai Hennig Newbie

      Hello, why do I have no access to injected components from an inner class? The variables (e.g. a reference to a stateless session bean annotated with @In(create=true)) are always null if accessed from an inner class of a seam component.

      Lets say, I have defined a wrapper class for an entity in my backing bean to provide easy access to additional entity features like detailed information in the view (e.g. fetched via a separate query with JOIN FETCH on relations). To get detailed information I need access to the facade from within the wrapper (wrappers are build from a list of entities returned from the facade, just to complete the picture):

      public class Index implements Serializable {
       @In(create = true)
       private FacadeLocal facade;
        public class EntityWrapper {
         private Entity entity
         public EntityWrapper(Entity entity) {
          this. entity = entity;
         public Entity getDetails() {
          // this will fail because facade is null
          return facade.getEntityDetails(entity.getId());

      I migrated to Seam. Before I did so, the above pattern worked fine.

      Best regards, Kai

      FACTS: Seam 2.1.0.SP1, Glassfish 9.1, Java 1.5.0, Mac OS X 10.5.5