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>
  • 相关阅读:
    Linux ld命令
    Linux readelf命令
    linux ar命令
    Linux升级Ruby
    Linux dkpg命令
    Linux apt-get命令
    Linux xxd命令
    Linux objdump命令
    Linux ldconfig命令
    git 删除目录
  • 原文地址:https://www.cnblogs.com/JinXinYuan/p/10517453.html
Copyright © 2011-2022 走看看