It is possible to use this approach:
Consider a properties file with the following elements:
test.properties :
beanlist1=
Now you can do it:
<context:property-placeholder location="test.properties"/> <bean id="bean1" class="java.lang.Integer /> <bean id="bean2" class="java.lang.Integer /> <bean class="customclass"> <constructor-arg value="${beanlist}></constructor-arg> </bean>
which is close enough to what you want (a slightly different view is #{{@bean1,@bean2}} instead of bean1,bean2 ).
Another way is the following:
<bean class="customclass"> <constructor-arg value="#{{@bean1,@bean2}}"></constructor-arg> </bean>
Both work using the Spring -EL expression to represent the list.
source share