使用bean的parent属性指定继承的哪个bean的配置
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="address" class="com.auguigu.spring.beans.autowire.Address" p:city="BeiJing" p:street="WuDaoKou"></bean> <bean id="address2" parent="address" p:street="DaZhongSi"></bean> </beans>
abstract为true的bean不能被实例化,只能用来被继承配置
<bean abstract="true"></bean>