zoukankan      html  css  js  c++  java
  • Spring(Bean)2

    <!-- util:list封装的心 -->

    <bean id="personList2" class="spring.beans.di.collections.PersonList">
    <property name="name" value="jiajiajia"></property>
    <property name="age" value="2444444"></property>
    <property name="cars" ref="cars"></property>
    </bean>
    
    <util:list id="cars">
    <ref bean="car1"/>
    <ref bean="car2"/>
    <bean class="spring.beans.di.Car">
    <property name="brand" value="AuDi"></property>
    <property name="crop" value="ShangHai"></property>
    <property name="price" value="400000"></property>
    <property name="maxSpeed" value="240"></property>
    </bean>
    </util:list>


    <!-- Person 手动装配 -->

    <bean id="person" 
    class="com.atguigu.spring.beans.autowire.Person"
    p:name="Tom" p:address-ref="address" p:car-ref="car"
    ></bean>

    <!-- Person 自动装配 
    byName: 根据IOC容器中bean的id值 与要装配的bean的set风格的属性进行匹配.
    byType: 根据IOC容器中bean的类型(class) 与要装配的bean的属性的类型进行匹配.-->

    <bean id="person" 
    class="com.atguigu.spring.beans.autowire.Person"
    p:name="jia222" autowire="byName"
    > <bean>
  • 相关阅读:
    算法第五章作业
    第四章实验报告
    算法第三章作业
    算法第三章上机实验报告
    算法第二章作业
    算法第二章上机实践报告
    算法 代码规范(C++)&《数学之美》读后感
    第七章学习小结
    第六章学习小结
    第五章学习小结
  • 原文地址:https://www.cnblogs.com/JinXinYuan/p/10517453.html
Copyright © 2011-2022 走看看