我有怀疑涉及到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