我們在我們的Spring上下文這個現有的財產裝載機配置方面:財產佔位如何引用屬性豆
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<util:list>
<value>hedging-service.properties</value>
</util:list>
</property>
</bean>
<!--Hedging properties bean that can be injected into other beans-->
<util:properties id="hedgingProperties" location="classpath:hedging-service.properties"/>
而且是引用hedgingProperties
豆
<bean id="mailProcessor"
class="a.b.c.MailProcessor">
<property name="properties" ref="hedgingProperties"/>
...
</bean>
我一個bean重構上下文以從多個屬性文件加載並避免重複定義屬性。我第一次嘗試是在地方兩個使用這個bean上述
<context:property-placeholder location="classpath:hedging-service-core.properties,classpath:hedging-service.properties,classpath:icon.properties"/>
,但我怎麼能留住別名或參考hedgingProperties
豆當我使用context:property-placeholder
?
你的意思是這個'特性-REF = 「hedgingProperties」'? ''的一個屬性。 –