Spring基于XML的DI-匿名Bean
匿名bean,就是没有名称(id)的bean,不能被其他bean用名称获取到,只能通过autowire=”byType”方式获取
<?xml version="1.0" encoding="UTF-8"?>
<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">
    <!-- com.hk.spring.di10.School的ID没有被用到
        可以定义为匿名bean,它只能被byType方式获取到
     -->
    <bean class="com.hk.spring.di10.School">
        <property name="schloolName" value="红林小学"/>
    </bean>
    <bean id="myStudent" class="com.hk.spring.di10.Student" autowire="byType">
        <property name="name" value="张三"/>
        <property name="age" value="9"/>
    </bean>
</beans>                
                










