【发布时间】:2018-11-23 08:31:04
【问题描述】:
我已将-Dspring.profiles.active 作为系统属性传递:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>#{'dev' or 'sit' or 'qa'.equals('${spring.profiles.active}') ? 'classpath:process${spring.profiles.active}.properties' : 'classpath:env/cfg/process-${spring.profiles.active}.properties'}
</value>
</list>
</property>
</bean>
如果我在 spring.profiles.active 中通过 dev,则条件应该通过,但实际上失败了。
但它已成功更新为 Properties,名为 process-dev.properties。
有人能指出我缺少什么吗?
【问题讨论】:
-
为什么你已经使用 XML 配置而不是 Java 注释的配置?
标签: java spring spring-boot spring-el system-properties