首页 > 解决方案 > PropertyPlaceholderConfigurer 与 xml 配置中的配置文件

问题描述

我正在尝试将 propertyPlaceholderConfigurer 放在 Spring 项目的 xml 配置中。我在运行项目之前设置了活动配置文件,并希望相应地设置属性文件层次结构。以下设置不起作用,因为它无法解决$spring.profiles.active

有人可以就如何解决这个问题提出建议。

<bean id="propertyPlaceholderConfigurer" class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer">
        <constructor-arg ref="configurationEncryptor" />
        <property name="locations">
            <list>
                <!-- Environment specific properties -->
                <value>file:application-$spring.profiles.active.properties</value>
                <!-- Application specific properties -->
                <value>file:application.properties</value>
            </list>
        </property>
        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
    </bean>

标签: springpropertiesprofile

解决方案


推荐阅读