Skip to content
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

Improve/disambiguate the documentation for spring.profiles.active #17436

Closed
behrangsa opened this issue Jul 5, 2019 · 2 comments
Closed

Improve/disambiguate the documentation for spring.profiles.active #17436

behrangsa opened this issue Jul 5, 2019 · 2 comments
Labels
status: superseded An issue that has been superseded by another type: documentation A documentation update

Comments

@behrangsa
Copy link

According to the documentation:

Sometimes, it is useful to have profile-specific properties that add to the active profiles rather than replace them. The spring.profiles.include property can be used to unconditionally add active profiles.

The example in the documentation shows two included profiles that look to have mutually exclusive properties:

spring.profiles.include:
  - proddb
  - prodmq

As evidenced by this question, and this comment, the documentation is a bit ambiguous.

Let's add this extra information to the documentation:

What happens when the active profile has a property definition that is also defined in one of the included profiles?

application-foo.yaml

myCustomProperty: 10

application-bar.yaml

spring:
  profiles:
    include: foo
myCustomProperty: 20

In this case, foo wins and myCustomProperty = 10.

What happens when the included profiles do not have mutually exclusive property definitions?

application-x.yaml

myCustomProperty: 10

application-y.yaml

myCustomProperty: 20

application-z.yaml

spring:
  profiles:
    include: x, y

myCustomProperty: 30

In this, y wins and myCustomProperty = 20.


Also, IMHO, when the included profiles (e.g. x and y in the example above) have shared property definitions, a warning log message should be emitted as I think a situation like this is the sign of a potential misconfiguration by the user.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 5, 2019
@mbhave
Copy link
Contributor

mbhave commented Jul 8, 2019

Profile includes can get quite tricky depending on the order, which can quickly make the documentation confusing. See this comment. We have a number of open issues around active and included profiles. It will probably lead to a bigger refactor of the profiles code and we can tackle this documentation issue as part of that.

@mbhave mbhave added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 8, 2019
@mbhave mbhave added this to the 2.x milestone Jul 8, 2019
@mbhave
Copy link
Contributor

mbhave commented Jul 31, 2020

With the rewrite of config file and profile processing in 2.4.x, profiles can no longer be included in profile specific sub sections. All profiles need to be available before any profile-specific files/documents are loaded. This issue can be closed.

@mbhave mbhave closed this as completed Jul 31, 2020
@mbhave mbhave added the status: superseded An issue that has been superseded by another label Jul 31, 2020
@mbhave mbhave removed this from the 2.x milestone Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

3 participants