3 Replies Latest reply on Feb 3, 2010 3:10 PM by Nikos Paraskevopoulos

    Seam Injection Issue

    pushpak1981 Novice

      Hi All,

      I have two Components defined at Application Scoped which are loaded when the server starts (using @startup Annotation). I wanted to access some variables from first component into second component. I have used @out annotation to outject and variable and @In annotation to inject into other component. But i am getting null values when it is injected.

      @Out(scope ScopeType.APPLICATION,value executionService)
      public ExecutionService executionService;

      @In(value executionService)
      public ExecutionService executionService;

      Any Help would be highly appreciated.


        • 1. Re: Seam Injection Issue
          yachaa Newbie

          The way I do it is as follow: ComponentA is created first

          public class ComponentA {
              String myProperty;
              public void onCreate() {

          When ComponentB is created, the ComponentA is injected to B

          public class ComponentB {
              ComponentA a;
              public void onCreate {

          Hope it helps.

          • 2. Re: Seam Injection Issue
            pushpak1981 Novice

            Thanks for the reply. I tried executing the code but it gives me NullPointerException in componentB while accessing the getMyProperty.The ComponentA is not injected. We are using Seam 2.1.

            • 3. Re: Seam Injection Issue
              Nikos Paraskevopoulos Novice


              Did you try the Factory Components, as described in ch 4.8 of Seam 2.2.0 documentation?