Skip to content

Propertysources precedence when merging the property source from @ConfigurationProperties' locations #5135

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

Closed
ilayaperumalg opened this issue Feb 12, 2016 · 4 comments

Comments

@ilayaperumalg
Copy link
Member

When the merge attribute for @ConfigurationProperties is set to true to merge the environment property sources along with the property sources specified in the locations, the property sources from the locations attribute gets the highest precedence.

Is this precedence level set for a reason? I was expecting the property source from locations getting the lowest precedence.

For instance, if I have a commandLine args for the application, wouldn't I expect this args override all the other property source including the one specified in locations attribute of ConfigurationProperties annotation.

@wilkinsona
Copy link
Member

@ilayaperumalg Originally, the location attribute ignored the rest of the environment completely. The merge attribute was added as that surprised people. They wanted their custom location to override the environment. You want it to be overridden by the environment. Satisfying both camps will, IMO, make things too complex. We're actually considering getting rid of locations altogether (see #5129). Please comment on that issue if you feel strongly that it should be retained and have a compelling use case for the added complexity.

@ilayaperumalg
Copy link
Member Author

@wilkinsona I see. I agree that it makes sense to keep one way of support and less complexity. Would be nice if we add Javadoc that says the precedence order on merge.

Thanks!

@wilkinsona
Copy link
Member

As it happens, @snicoll improved the javadoc yesterday. See 594c891

@ilayaperumalg
Copy link
Member Author

Cool! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants