-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review Default Profile section in the reference documentation #30319
Comments
It's not clear what will happen if both |
I don't understand the problem to be honest.
So if you set it, you just change the name of the default profile. This doesn't do anything else as described above.
If you customize the name of the default profile and the you active a profile explicitly, those two things are unrelated. As already stated in the doc, activating a profile means that the default profile fallback does not apply.
That's also unrelated. If you don't have a profile at all, beans are always created. If you have a profile that matches the name of the default profile, it's considered only if no profile is active. I've polished the section a bit with an explicit link to what it means to activate a profile. If you want to refine, feel free to submit a PR and we can continue the conversation. |
It seems that |
Default only set a name to use as a fallback. It’s a mechanism to allow you to enable a profile if no other profile is active. Active predates support for default profile. These are not the same as, as soon as you want certain profiles to he enabled, the default won’t be. I am sorry but I don’t know where the confusion comes from. |
For example, if we defined profile |
I don't think this discussion is going anywhere. Making the case that Let's say a company ships a product "myproduct" with customizations for "customerA" and "customerB" that are enabled by Spring profiles. Beans for the vanilla product should be named "default" if we want them to be contributed to the app, unless a "customerA" or "customerB" profile is chosen by the user. It would be nice to have those named "myproduct" as "default" is really generic. If we remove this possibility, developers would rightfully complain that:
|
I'm not saying current design is problematic, I'm saying it confuse people like me. |
In the current reference documentation exists the Default Profile section. It has the following content
Starting with a code:
and the following content/explanation:
Therefore: Why from the beginning was not used directly
spring.profiles.active
? - it especially taking in consideration that is known thatspring.profiles.active
has more precedence and overrides by completespring.profiles.default
as indicated in bold above.As summary:
spring.profiles.default
exist if the same approach can be accomplished throughspring.profiles.active
?Is not clear when is mandatory use the former over the latter - and taking the special consideration about the behavior of overriding if the latter is declared.
Just in case, the @Profile javadoc does not contain some indication about this
I create a post on SO at:
But I think the explanation from the source (here) should be expanded. Thanks for your understanding
The text was updated successfully, but these errors were encountered: