Spring初始化集合
来源:互联网 发布:c语言入门教程txt 编辑:程序博客网 时间:2024/05/14 13:37
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="chinese" class="Bean.collections.Chinese"> <property name="schools"> <list> <value>小学</value> <value>中学</value> <value>大学</value> </list> </property> <property name="health"> <props> <prop key="血压">正常</prop> <prop key="身高">178</prop> </props> </property> <property name="scores"> <map> <entry key="数学"> <value>88</value> </entry> <entry key="语文"> <value>99</value> </entry> </map> </property> <property name="axes"> <set> <value>字符串斧子</value> <!-- 用嵌套bean定义属性 --> <bean class="Bean.collections.WoodAxe"/> <!-- 引用bean作为属性 --> <ref local="steelaxe"/> </set> </property> </bean> <bean id="steelaxe" class="Bean.collections.SteelAxe"></bean> </beans>