Spring autowire byType with util:list
<p>I am learning spring (and following Spring in Action), As I was playing around to understand few concept; then I observed following behavior.</p>

<p><strong>Scenario:</strong> <br>
I wanted to autowire a list property in a Class by using "byType" autowire option. so I created util:list bean; which successfully get injected... so no surprise here :). <br>
Then I added a new list property in the same class(of different class hierarchy: off-course); then that too get injected without doing any extra wiring.... :O
<br><br>
Can any body explain whats going on under the hood. <br>
Below is some code snippt.</p>

<pre><code>   public interface Performer {
    public void perform();
}

public interface Instrument {
    public void play();
}


public class Show implements Audotorium {
    Logger logger = Logger.getLogger(Show.class.getName());

    List&lt;Performer&gt; performerList;
    List&lt;Instrument&gt; instruments;

    public void setPerformerList(List&lt;Performer&gt; performerList) {
        this.performerList = performerList;
    }

    public void setInstruments(List&lt;Instrument&gt; instruments) {
        this.instruments = instruments;
    }

    public void show() {
        Iterator&lt;Performer&gt; performerItr = performerList.iterator();
        while (performerItr.hasNext()) {
            performerItr.next().perform();
        }

        Iterator&lt;Instrument&gt; instrumentItr = instruments.iterator();
        while (instrumentItr.hasNext()) {
            instrumentItr.next().play();
        }
    }
}
</code></pre>

<p><strong>Main Class<br></strong></p>

<pre><code>  public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring-context.xml");
        ((Show) context.getBean("show")).show();
    }
</code></pre>

<p><strong>Bean Configration:<br></strong></p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;bean id="juggler" class="com.learning.Juggler"/&gt;
    &lt;bean id="magcian" class="com.learning.Magician"/&gt;
    &lt;bean id="kenny" class="com.learning.Instrumentalist"&gt;
        &lt;property name="song" value="bay finger bay finger"/&gt;
        &lt;property name="instrument" ref="saxphone"/&gt;
    &lt;/bean&gt;
    &lt;bean id="hunk" class="com.learning.OneManBand" autowire="byType"&gt;
        &lt;property name="song" value="bay finger bay finger"/&gt;
        &lt;property name="instruments"&gt;
            &lt;list&gt;
                &lt;ref bean="saxphone"/&gt;
                &lt;ref bean="guitar"/&gt;
                &lt;ref bean="harmonica"/&gt;
            &lt;/list&gt;
        &lt;/property&gt;
    &lt;/bean&gt;
    &lt;bean id="totalBeanBags" class="java.lang.Integer" factory-method="valueOf"&gt;
        &lt;constructor-arg value="#{performerList.size()}"/&gt;
    &lt;/bean&gt;


    &lt;bean id="saxphone" class="com.learning.SaxPhone"/&gt;
    &lt;bean id="guitar" class="com.learning.GenaricInstument"&gt;
        &lt;property name="instrumentSound" value="guitar sound"/&gt;
    &lt;/bean&gt;
    &lt;bean id="harmonica" class="com.learning.GenaricInstument"&gt;
        &lt;property name="instrumentSound" value="harmonica sound"/&gt;
    &lt;/bean&gt;


    &lt;util:list id="performerList"/&gt;

    &lt;bean id="show" class="com.learning.Show" autowire="byType"&gt;

    &lt;/bean&gt;</code></pre>
</div>
</div>
</p>

<p><strong>Output:<br></strong></p>

<pre><code>JUGGLING 10 BEANBAGS
Showing some crazy magicSSsssSSSsss.....
Playing bay finger bay finger :  TOO TOO TOO
Playing bay finger bay finger :  TOO TOO TOO
guitar sound
harmonica sound
----Now its music time----
 TOO TOO TOO
guitar sound
harmonica sound
</code></pre>