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"/>
そして、Beanを参照するhedgingProperties
Beanがあります
<bean id="mailProcessor"
class="a.b.c.MailProcessor">
<property name="properties" ref="hedgingProperties"/>
...
</bean>
複数のプロパティ ファイルからロードするようにコンテキストをリファクタリングし、プロパティの定義が重複しないようにしています。私の最初の試みは、上記の2つの代わりにこのBeanを使用することです
<context:property-placeholder location="classpath:hedging-service-core.properties,classpath:hedging-service.properties,classpath:icon.properties"/>
hedgingProperties
しかし、使用時にBeanへのエイリアスまたは参照を保持するにはどうすればよいcontext:property-placeholder
ですか?