如何从父bean继承单个属性到子bean

时间:2016-02-06 03:23:37

标签: spring

这里?在我的Spring代码中,所有属性都是继承的,但我只需要将属性传递给我的子类

<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-3.0.xsd">

    <bean id="baseEmployeeBean" class="com.java.beans.BaseEmployee">
        <property name="company" value="Java2novice" />
        <property name="address" value="mumbai" />
    </bean>
    <bean id="myEmployeeBean" class="com.java.beans.Employee" parent="baseEmployeeBean">
        <property name="empId" value="1016" />
        <property name="name" value="Nataraja Gootooru" />
    </bean>
</beans>

0 个答案:

没有答案
相关问题