欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

spring bean中注入List, Set,Map,springbean,<?xml versio

来源: javaer 分享于  点击 17768 次 点评:23

spring bean中注入List, Set,Map,springbean,
<?xml version="1.0" encoding="UTF-8"?><beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns="http://www.springframework.org/schema/beans"    xsi:schemaLocation="http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">    <!-- 定义一个普通的Axe Bean -->    <bean id="steelAxe" class="com.spring.service.impl.SteelAxe" />    <bean id="stoneAxe" class="com.spring.service.impl.StoneAxe" />    <!--定义Chinese Bean -->    <bean id="chinese" class="com.spring.service.impl.Chinese">        <property name="schools">            <list>                <value>小学</value>                <value>中学</value>                <value>大学</value>            </list>        </property>        <property name="scores">            <map>                <entry key="语文" value="88" />                <entry key="数学" value="87" />                <entry key="外语" value="88" />            </map>        </property>        <property name="phaseAxes">            <map>                <entry key="原始社会" value-ref="stoneAxe" />                <entry key="农业社会" value-ref="steelAxe" />            </map>        </property>        <property name="health">            <props>                <prop key="血压">正常</prop>                <prop key="身高">175</prop>            </props>        </property>        <property name="axe">            <set>                <value>普通字符串</value>                <bean class="com.spring.service.impl.SteelAxe"></bean>                <ref local="stoneAxe"/>            </set>        </property>        <property name="books">            <list>                <value>java 编程思想</value>                <value>思考致富</value>                <value>将才</value>            </list>        </property>    </bean></beans>

相关栏目:

用户点评