Chad
Chad

Reputation: 2081

Default value for application.properties (profile) environment placeholder cannot be comma separated

I have the following property in my application.properties.

spring.profiles.active=dev,local

This works fine. However, I decided to also expose this as an environment variable and keep dev,local as the default values. However the following does not work.

spring.profiles.active=${PROFILES_ACTIVE:dev,local}

It seems comma causes this issue.

Checking the logs

[2018-05-24 05:38:28.163] [main] [INFO] [Application] The following profiles are active: ${PROFILES_ACTIVE:dev,local}

However, the following works.

spring.profiles.active=${PROFILES_ACTIVE:dev}

Any suggestions on how go about this?

Upvotes: 10

Views: 22859

Answers (1)

Plamen
Plamen

Reputation: 323

Try:

spring.profiles.active=${PROFILES_ACTIVE:#{'dev,local'}}

It uses the EL syntax with templating.

Upvotes: 7

Related Questions