6 Replies Latest reply on Feb 23, 2009 5:11 AM by welle

    Howto inject beans into a collection

    welle

      Hi all,

      I just started looking at the Microcontainer and wonder how I should inject beans into a collection (List) that is a property to another bean?

      I can't find any examples how this should be done (if possible).

      <bean name="a" class="xxx.xxx.A">
       <property name="listOfB">
       <list elementClass="xxx.xxx.B">
       <value><inject bean="b1"/></value>
       <value><inject bean="b2"/></value>
       <value><inject bean="b3"/></value>
       </list>
       </property>
      </bean>
      
      <bean name="b1" class="xxx.xxx.B">...</bean>
      <bean name="b2" class="xxx.xxx.B">...</bean>
      <bean name="b3" class="xxx.xxx.B">...</bean>
      



      Best regards
      Anders