If a Bean's properties are collections, you can use the <list/>, <set/>, <map/>, and <props/> elements to inject values into the properties of list, set, map, and property types.
Sample configuration for injecting collection values:
<BeanID= "Morecomplexobject"class= "Example.complexobject"> <!--results in a setadminemails (java.util.Properties) call - < Propertyname= "Adminemails"> <Props> <propKey= "Administrator">[Email protected]</prop> <propKey= "Support">[Email protected]</prop> <propKey= "Development">[Email protected]</prop> </Props> </ Property> <!--results in a setsomelist (java.util.List) call - < Propertyname= "Somelist"> <List> <value>A list element followed by a reference</value> <refBean= "myDataSource" /> </List> </ Property> <!--results in a setsomemap (JAVA.UTIL.MAP) call - < Propertyname= "Somemap"> <Map> <entryKey= "an entry"value= "Just some string" /> <entryKey= "a ref"Value-ref= "myDataSource" /> </Map> </ Property> <!--results in a setsomeset (java.util.Set) call - < Propertyname= "Someset"> <Set> <value>Just some string</value> <refBean= "myDataSource" /> </Set> </ Property></Bean>
Spring (3.2.3)-Beans (5): Injection of collection properties