KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm loading properties attributes from a .properties file using Spring as follows: 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 The spring xml file file: myapplication.xml <bean id="some" class="com.some.Class"> <property name="property" value="#{base.module.elementToSearch}" /> </bean> And my Class.java file: Class.java public void setProperty(final List<Integer> elements){ this.elements = elements; } 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. I tried other approaches, like adding in value only #{base.module} but then it finds no parameter in the properties file. A workaround is to have in elements.properties file a list separated by commas, like: base.module.elementToSearch=1,2,3,4,5,6 and use it as a String and parse it, but is there a better solution?
Tags (comma-separated)
Save Edits
Cancel