Bean的自动装配

1.autowire byName byType

点击查看代码
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="cat" class="com.xixi.Cat"></bean>
    <bean id="dog" class="com.xixi.Dog"></bean>
    <bean id="people" class="com.xixi.people" autowire="byName">
        <property name="name" value="xixi" ></property>
    </bean>
</beans>
posted @ 2024-09-13 15:18  梦想_demo  阅读(14)  评论(0)    收藏  举报