【问题标题】:Equivalent of PropertySourcesPlaceHolderConfigurer to PropertyOverrideConfigurerPropertySourcesPlaceHolderConfigurer 等价于 PropertyOverrideConfigurer
【发布时间】:2015-04-28 11:16:57
【问题描述】:

PropertySourcesPlaceHolderConfigurer 可以从属性源中查找占位符的值。是否有与使用属性源覆盖属性定义的 PropertyOverrideConfigurer 的等效项?

【问题讨论】:

    标签: java spring spring-3


    【解决方案1】:
        <bean class="org.springframework.beans.factory.config.PropertyOverrideConfigurer>
            <property name="location" value="file:${your_property_from_PropertySourcePlaceholderConfigurer}/override.properties"/>
            <property name="localOverride" value="true" />
        </bean>
    

    【讨论】:

    • 谢谢 androberz。但是,我正在寻找的是一种让 PropertyOverrideConfigurer 查看环境中的 PropertySources 而不是属性文件位置来加载属性的方法。
    • 从我在jira.spring.io/browse/SPR-12853 看到的内容来看,此功能在 4.1.6 中不起作用,并认为它可以在 rel 4.2.0 快照中起作用
    猜你喜欢
    • 2023-04-11
    • 2014-04-14
    • 1970-01-01
    • 2022-01-12
    • 2013-08-08
    • 2014-02-15
    • 2011-09-19
    • 2016-10-26
    • 2014-07-28
    相关资源
    最近更新 更多