Be sure to configure the set method for the property at the time of input, because the setting is not injected.
1.list
Userservice.java
Private ArrayList arr; Public ArrayList Getarr () { return arr;} Public void Setarr (ArrayList arr) { this. arr = arr;}
Service.xml
class= "Com.sun.service.UserService" > <property name= "name" > <value>sunxin</ value> </property> <property name= "arr" > <list> <value>tom</value > <value>Jack</value> <value>Jeson</value> </list> </ Property></bean>
2.map
Private map<string, float> accounts; Public void setaccounts (map<string, float> accounts) { this. accounts= accounts; }
Service.xml
<beans> Class= "Com.sun.service.UserService" > <property name= "Accounts" > <map> <entry key= "one" value= "9.99"/> <entry key= "one" value= "2.75"/> <entry key= " Six "value=" 3.99 "/> </map> </property> </bean></beans>
Java Spring Collection