我有懷疑涉及到PropertyPlaceholderConfigurer。以下是我在application-context.xml文件中的配置。根據文檔,它將首先查看{user.home}/conf目錄中的application.properties。如果不存在,那麼它將從classpath加載,這是真的。PropertyPlaceholderConfigurer如何加載屬性文件?
現在我有一個問題,如果一個鍵值不存在於{user.home}/conf目錄的application.properties文件中,但是它存在於classpath的application.properties文件中。那麼它將如何識別和加載該關鍵值?
對於冗長的解釋感到抱歉。
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:application.properties</value>
<value>file:///${user.home}/conf/application.properties</value>
</list>
</property>
如果兩個.properties都可用,則加載所有密鑰。 – 2014-12-05 14:04:38