Can you create a List in a Spring application-context.xml file without using the <list> element?
I have a bean whose constructor takes a Collection object and I want to pass the entire list through the “value” attribute. The reason is that this value comes from a .properties file and you can’t define a list in a .properties file.
I want to do something like this…is it possible?
MyClass.java:
public class MyClass{
public MyClass(Collection<String> collection){ /* ... */ }
}
application-context.xml:
<bean name="myBean" class="com.company.MyClass">
<constructor-arg value="${the.value}" />
</bean>
.properties file:
the.value=item1,item2,item3
Thanks.
1 Answer