簡體   English   中英

澄清Spring上下文:屬性占位符局部重寫用法

[英]Clarifying Spring context:property-placeholder local-override usage

我正在使用本地替代來指定屬性,並想確認這僅適用於applicationContext中指定的屬性。 基本上我想確保這不會有任何意外的后果...

<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>

除$ {some.property}以外的任何屬性都不會被覆蓋,是嗎?

除$ {some.property}外的所有屬性都不會被以下代碼覆蓋:

<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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM