Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从工厂接收的Spring父bean是否具有属性?_Java_Spring_Javabeans - Fatal编程技术网

Java 从工厂接收的Spring父bean是否具有属性?

Java 从工厂接收的Spring父bean是否具有属性?,java,spring,javabeans,Java,Spring,Javabeans,我有一个具有map属性的抽象父bean。 此映射必须与子映射属性合并。 这是工作。但当我把这个bean作为工厂中的内部时,映射属性似乎消失了。 我想内部bean的字段对child不可用 <bean id="parent" factory-bean="factory" factory-method="createbean"> <constructor-arg> <bean abstract="true"> <property

我有一个具有map属性的抽象父bean。 此映射必须与子映射属性合并。 这是工作。但当我把这个bean作为工厂中的内部时,映射属性似乎消失了。 我想内部bean的字段对child不可用

<bean id="parent" factory-bean="factory"
 factory-method="createbean"> 
  <constructor-arg>
    <bean abstract="true">
       <property name="prop" > 
         <map>
           <entry ............
           .................
         </map 
 ...............


以下是一个工作示例:

<bean id="parent" abstract="true" factory-bean="factory" factory-method="createBean">
    <constructor-arg index="0">
        <props>
            <prop key="One">one-value</prop>
            <prop key="Three">three-value</prop>
        </props>
    </constructor-arg>
</bean>

<bean id="child" parent="parent">
    <constructor-arg index="0">
        <props merge="true">
            <prop key="Two">two-value</prop>
            <prop key="Three">not-three-value</prop>
        </props>
    </constructor-arg>
</bean>
请注意,“Three”键的值被重写,因为它包含在子bean中

<bean id="parent" abstract="true" factory-bean="factory" factory-method="createBean">
    <constructor-arg index="0">
        <props>
            <prop key="One">one-value</prop>
            <prop key="Three">three-value</prop>
        </props>
    </constructor-arg>
</bean>

<bean id="child" parent="parent">
    <constructor-arg index="0">
        <props merge="true">
            <prop key="Two">two-value</prop>
            <prop key="Three">not-three-value</prop>
        </props>
    </constructor-arg>
</bean>
One=one-value
Two=two-value
Three=not-three-value