<?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">
<!-- 同类抽象bean -->
<bean id="baseStudent" class="com.gqc.di11.Student" abstract="true">
<property name="school" value="清华大学"/>
<property name="department" value="计算机"/>
</bean>
<!-- 注册Student-->
<bean id="myStudent" parent="baseStudent">
<property name="name" value="张三"/>
<property name="age" value="11" />
</bean>
<!-- 注册Student-->
<bean id="myStudent2" parent="baseStudent">
<property name="name" value="李四"/>
<property name="age" value="11" />
</bean>
<!-- 注册Student-->
<bean id="myStudent3" parent="baseStudent">
<property name="name" value="王五"/>
<property name="age" value="11" />
</bean>
</beans>
<?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">
<bean id="baseBean" abstract="true">
<property name="school" value="清华大学"/>
<property name="department" value="计算机"/>
</bean>
<!-- 注册Student-->
<bean id="myStudent" class="com.gqc.di12.Student" parent="baseBean" >
<property name="name" value="张三"/>
<property name="age" value="11" />
</bean>
<!-- 注册Student-->
<bean id="myTeacher" class="com.gqc.di12.Teacher" parent="baseBean">
<property name="name" value="gqc"/>
<property name="workAge" value="21" />
</bean>
</beans>