Anto
Anto

Reputation: 21

-Dspring.profiles.active not recognized under condition

I have passed -Dspring.profiles.active as a system property:

<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>

If I pass dev in spring.profiles.active the condition should pass but it is actuallay failing.

But it gets updated successfully with Properties named process-dev.properties.

Could someone point out what I am missing?

Upvotes: 2

Views: 514

Answers (1)

Sofo Gial
Sofo Gial

Reputation: 703

You should change it to 'dev'.equals('${spring.profiles.active}') or 'sit'.equals('${spring.profiles.active}') or 'qa'.equals('${spring.profiles.active}')

Upvotes: 2

Related Questions