Spring4之IOC
或第六讲前也是讲此知识。
\[www.dev1234.com]一头扎进Spring4视频教程\一头扎进Spring4源码\[www.java1234.com]《一头扎进Spring4》第六讲 源码
继承的xml配置方式:
<bean id="abstractPeople" class="com.java1234.entity.People" abstract="true"> <property name="className" value="高三5班"></property> <property name="age" value="19"></property> </bean> <bean id="zhangsan" parent="abstractPeople" depends-on="autority"><!--依赖 会优先到后方获取autority bean--> <property name="id" value="1"></property> <property name="name" value="张三"></property> </bean> <bean id="lisi" parent="abstractPeople"> <property name="id" value="2"></property> <property name="name" value="李四"></property> <property name="age" value="20"></property> <!--重写了此属性 --> </bean>
<bean id="autority" class="com.java1234.service.Authority"></bean>
<bean id="dog" class="com.java1234.entity.Dog" scope="singleton"> <property name="name" value="jack"></property> </bean>