如何将application.properties文件的值更新为另一个属性文件的名称

时间:2018-11-21 12:46:37

标签: java spring spring-boot

我有2个属性文件application.properties和process.properties。我必须从application.properties中读取spring.profiles.active,并且需要根据环境调用process- {spring.profiles.active} .properties,例如process-dev.properties。

    <context:property-placeholder
    location="classpath:application.properties" />
<context:property-placeholder
    location="classpath:process-${spring.profiles.active}.properties" />

我正面临

  

无法解析占位符'spring.profiles.active'的价值   “ classpath:process-$ {spring.profiles.active} .properties”由以下原因引起:   java.lang.IllegalArgumentException:无法解析占位符   价值“ spring.profiles.active”   “ classpath:process-$ {spring.profiles.active} .properties”

请提供建议

0 个答案:

没有答案