title: How to write a spring bean with a constructor that contains a list?
body: <p>I have a list as follows:</p>
  
  <pre><code>ArrayList&lt;DiameterMessageHandler&gt; handlers = new ArrayList&lt;&gt;();
  handlers.add(new AARHandler());
  handlers.add(new CERHandler());
  handlers.add(new PPAHandler());
  handlers.add(new STRHandler());
  handlers.add(new DWRHandler());
  </code></pre>
  
  <p>I am wondering how to create a spring bean that takes handlers as one of its arguments, i.e. is it possible to do this in the applicationContext.xml - Do I have to create separate beans for the list and each of the handlers(AARHandler etc) first? Here is my applicationContext.xml</p>
  
  <pre><code>&lt;bean id="DiameterClient" class="com.rory.ptspsim.diameterclient.DiameterClient" scope="singleton" init-method="start"&gt;
          &lt;constructor-arg type="java.lang.String" index="0"&gt;&lt;value&gt;${pcca.host}&lt;/value&gt;&lt;/constructor-arg&gt;      
          &lt;constructor-arg index="1"&gt;WHAT GOES HERE?&lt;/constructor-arg&gt;        
      &lt;/bean&gt;
  </code></pre>