Reputation: 1287
I would like to use a dynamic placeholder inside the PropertySource
value options.
This is in order to have the ability to have one file for each environment which overrides the default one. Just like application.properties
and application-dev.properties
.
Current setup:
@PropertySource("classpath:ione.properties")
I would like to have something like
@PropertySource("classpath:ione-{optionalEnvName}.properties")
Thus reading the --spring.profiles.active=dev
option.
Thanks!
Upvotes: 1
Views: 6600
Reputation: 146
Run with:
-Dspring.profiles.active=dev
and then:
@PropertySource("classpath:ione-${spring.profiles.active}.properties")
should work
Upvotes: 4