Reputation: 1192
I'm currently maintaining a legacy codebase where the following Spring profile configuration has been specified in the application context:
spring.profiles.active=addressbook-[usermanager|webservices],entrypoint-[form|saml]
The question is: how do I read what is specified in this example for spring.profiles.active
?
Am I right in thinking that there are 4 possible profile definitions here? Namely:
addressbook-usermanager, entrypoint-form
addressbook-webservices, entrypoint-form
addressbook-usermanager, entrypoint-saml
addressbook-webservices, entrypoint-saml
Is there a way to turn on logging to see which profile is chosen and which beans get loaded for a particular profile? And if not, why they didn't get loaded?
I'm plowing through this blog post and any other kind of documentation that I can find, but I haven't found anything specific to the profile specification syntax above. Is there any documentation available?
Thanks!
Upvotes: 0
Views: 204
Reputation: 116341
I'm not aware of any support in Spring for the syntax that you've described above. I believe that the configuration you've described will give you two active profiles:
addressbook-[usermanager|webservices]
entrypoint-[form|saml]
You can query the currently active profiles using Environment.getActiveProfiles()
. To get hold of the Environment
instance, you can use Spring's auto-wiring or implement EnvironmentAware
.
You might also want to look at ProfileCondition
. There's no logging in it, but you could use the debugger to see beans being included or excluded based on their @Profile
annotation.
Upvotes: 2