【问题标题】:Default and Production configuration in Spring [duplicate]Spring中的默认和生产配置[重复]
【发布时间】:2016-02-19 15:53:59
【问题描述】:

我在类路径中有默认应用程序属性。如果文件存在,我需要从文件的外部属性中覆盖它。

现在加载属性如下:

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

有没有办法做到这一点?

【问题讨论】:

标签: java spring properties


【解决方案1】:

为 bean 添加属性

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

并在位置指定您的外部属性文件

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

【讨论】:

    猜你喜欢
    • 2019-06-21
    • 1970-01-01
    • 1970-01-01
    • 2012-04-19
    • 2020-12-12
    • 2016-11-07
    • 2016-03-21
    • 2013-02-16
    • 2017-06-23
    相关资源
    最近更新 更多