3 Replies Latest reply on Apr 27, 2010 11:34 AM by David Bosschaert

    Is there auto-injection going on?

    David Bosschaert Expert

      Looking at the Spring demo in the User's Guide examples I can see that it references the mcBean and gets injected by it. However the mcBean itself doesn't explicitly reference the SimpleBean...

       

      {code:xml}<bean id="testBean" class="org.jboss.example.microcontainer.spring.SimpleBean">   

         <!-- other stuff -->

         <property name="refBean"><ref bean="mcBean"/></property>
      </bean>

       

      <bean xmlns="urn:jboss:bean-deployer:2.0" name="mcBean" class="org.jboss.example.microcontainer.spring.MCBean"/>{code}

       

      however, the MCBean still gets injected by the SimpleBean through the setSimpleBean() method

       

      {code}public class MCBean
      {
         public void setSimpleBean(SimpleBean simpleBean)
         {
            System.out.println("Setting simple bean: " + simpleBean);
         }
      }{code}

       

      Is there some auto-injection going on or am I missing the declaration for it somewhere?