简体   繁体   中英

Clarifying Spring context:property-placeholder local-override usage

I'm using a local override to specify a property and wanted to confirm that this just applies to properties that are specified in the applicationContext. Basically I want to make sure that this doesn't have any unexpected consequences...

<context:property-placeholder
    properties-ref="defaultProperties"
    location="classpath:my.properties"
    ignore-resource-not-found="true"
    ignoreunresolvable="true"
    local-override="true"/>

<util:properties id="defaultProperties">
    <prop key="some.property">${overriding.property}</prop>
</util:properties>

No properties except ${some.property} will be overridden, yes?

No properties except ${some.property} will be overridden with below code:

<context:property-placeholder  properties-ref="defaultProperties" location="classpath:my.properties, "ignore-resource-not-found="true" ignoreunresolvable="true" local-override="true"/> 

<bean id="defaultProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
    <util:properties local-override="true">
        <prop key="some.property">${overriding.property}</prop>
    </util:properties>
</property>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM