我已将 -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,条件应该会通过,但实际上失败了。
但它已通过名为 process-dev.properties 的 Properties
成功更新。
有人可以指出我缺少什么吗?
最佳答案
您应该将其更改为 'dev'.equals('${spring.profiles.active}') 或 'sit'.equals('${spring.profiles.active}') 或 'qa' .equals('${spring.profiles.active}')
关于java - -Dspring.profiles.active 在条件下无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53443073/