title: Spring .properties file: get element as an Array
body: <p>I'm loading properties attributes from a <code>.properties</code> file using Spring as follows:</p>
  
  <pre><code>file: elements.properties
  base.module.elementToSearch=1
  base.module.elementToSearch=2
  base.module.elementToSearch=3
  base.module.elementToSearch=4
  base.module.elementToSearch=5
  base.module.elementToSearch=6
  </code></pre>
  
  <p>The spring xml file</p>
  
  <pre><code>file: myapplication.xml
  &lt;bean id="some"
        class="com.some.Class"&gt;
        &lt;property name="property" value="#{base.module.elementToSearch}" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>And my Class.java</p>
  
  <pre><code>file: Class.java
  public void setProperty(final List&lt;Integer&gt; elements){
      this.elements = elements;
  }
  </code></pre>
  
  <p>But when debugging, the parameter elements only get the last element into the list, so, there is a list of one element with value "6", instead of a list with 6 elements.</p>
  
  <p>I tried other approaches, like adding in value only <code>#{base.module}</code> but then it finds no parameter in the properties file.</p>
  
  <p>A workaround is to have in elements.properties file a list separated by commas, like:</p>
  
  <pre><code>base.module.elementToSearch=1,2,3,4,5,6
  </code></pre>
  
  <p>and use it as a String and parse it, but is there a better solution?</p>