springframework (バージョン 2.5.x) の Bean を定義する 2 つの xml ファイルがあります。
containerBase.xml:
<beans>
    <bean id="codebase" class="com.example.CodeBase">
        <property name="sourceCodeLocations">
            <list>
                <value>src/handmade/productive</value>
            </list>
        </property>
    </bean>
</beans>
... と
containerSpecial.xml:
<beans>
    <import resource="containerBase.xml" />
</beans>
sourceCodeLocations今私は Beancodebase内のプロパティを調整したいと思いますcontainerSpecial.xml。2 番目の値を追加する必要がありますsrc/generated/productive。
簡単な方法codebaseは、 inの定義をオーバーライドして、元の値と新しいcontainerSpecial.xml値の両方の値を追加することです。containerBase.xml
containerSpecial.xml:
<beans>
    <import resource="containerBase.xml" />
    <bean id="codebase" class="com.example.CodeBase">
        <property name="sourceCodeLocations">
            <list>
                <value>src/handmade/productive</value>
                <value>src/generated/productive</value>
            </list>
        </property>
    </bean>
</beans>
Bean を再定義せずにリストを拡張する方法はありますか?
編集 2009-10-06:
containerBaseこれの目的は、多くの異なるプロジェクトで使用される共有標準コンテナーを持つことです。各プロジェクトは、そのプロジェクトに固有のいくつかのプロパティを独自の でオーバーライド/拡張できますcontainerSpecial。プロジェクトがオーバーライドされない場合は、 で定義されたデフォルトが使用されcontainerBaseます。