3 Replies Latest reply on Nov 16, 2008 10:50 AM by Dan Allen

    Nested Seam Component Injection Corruption

    P C Newbie
      Hi,

      I have recently upgraded from Seam 2.0.0 GA to 2.1.0 SP1 and I encountered the following problem with nested seam component injection which worked in 2.0.0 GA:

      public class A
      {
         @In
         private B objectB;

         public void methodA()
         {
            objectB.methodB();
         }

         public void methodC()
         {

         }
      }

      public class B
      {
         @In
         private A objectA;

         public void methodB()
         {
            objectA.methodC();
         }
      }

      I am using the spring framework to instantiate my spring beans as seam components:

      <bean id="objectB" class="B">
         <seam:component/>
      </bean>

      <bean id="objectA" class="A">
         <seam:component/>
      </bean>

      Now, if I call Class A's methodA() which in turn calls Class B's methodB() which in turn calls Class A's methodC(), fields inside Class A including the injected field objectB will be corrupted.  This nested injection worked for me in Seam 2.0.0 GA, but now it seems to be not working in Seam 2.1.0 SP1. 

      If I declare both objectB and objectA of scope="prototype" then it works, but this is undesirable as I want to use singletons.

      Can the Seam folks confirm whether this is a bug or should this work at all?

      Thanks a bunch!

      Paul