2014-01-28 42 views
1

我使用本地覆蓋來指定一個屬性並希望確認這僅適用於在applicationContext中指定的屬性。基本上我要確保這不會有任何意外的後果......澄清Spring上下文:屬性佔位符本地覆蓋使用

<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沒有屬性將被覆蓋,是嗎?

回答

1

除了$ {} 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> 

相關問題