2016-02-19 86 views
0

我在classpath中有默认的应用程序属性。如果存在,我需要从文件的外部属性中覆盖它。Spring中的默认和生产配置

现在正在加载性能似乎如下:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <property name="locations"> 
     <list> 
      <value>classpath:some-configuration.properties</value> 
      <!--...--> 
     </list> 
    </property> 
</bean> 

有没有办法做到这一点?

+2

也许这可以帮助http://stackoverflow.com/questions/17443534/propertyplaceholderconfigurer-use-external -properties-file – hasnae

+0

@hasnae谢谢,它适用于我 –

回答

0

添加属性豆

<property name="ignoreResourceNotFound" value="true" /> 

,并指定你的外部属性的位置文件中

<value>file:/env/another-configurations.properties</value>