<bean id="department" class="com.pojo.Department"> <property name="name" value="人事部"></property> <!-- 数组 --> <property name="empName"> <list> <value>张三</value> <value>李四</value> </list> </property> <!-- list --> <property name="list"> <list> <ref bean="employee"/> <ref bean="employee2"/> </list> </property> <!-- set --> <property name="set"> <set> <ref bean="employee"/> <ref bean="employee2"/> </set> </property> <!-- map --> <property name="map"> <map> <entry key="1" value-ref="employee"></entry> <entry key="2" value-ref="employee2"></entry> </map> </property> </bean> <bean id="employee" class="com.pojo.employee"> <property name="name" value="张三" /> <property name="id" value="1"/> </bean> <bean id="employee2" class="com.pojo.employee"> <property name="name" value="李四"/> <property name="id" value="2"/> </bean>
原文地址:https://www.cnblogs.com/lc0814/p/8328485.html
时间: 2024-10-27 12:37:41