-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Document property source precendence using spring.config.import defined in application.yml vs adding as -Dspring.config.import #1838
Comments
#1839 ( Pull Request link ) |
Spring cloud has no control over the precedence anymore, it is controlled by spring boot. IIRC @philwebb and I had a conversation about this and he said this is the working behavior of boot. |
@spencergibb , there is no consistency in working behavior of boot then.
latter is the best fit (abides by spring cloud documentation) logically - which should be made uniform irrespective of how |
@philwebb will have to talk about that. |
@philwebb @spencergibb : this is not a documentation bug (it is incorrectly labelled so). |
@maggmanu77 as I've said, spring cloud can only document this, I can't change the behavior. You'll need to file an issue in spring boot. |
Something else to consider in the documentation #1807 (comment) |
I've pushed something to Spring Boot that will allow imported |
We started running into this recently when we finally started upgrading Spring Boot, and I believe the issue is slightly more involved than described. We are running on Spring Boot 2.7.4 and Cloud Config Server 2022.0.1 and we are experiencing different results depending on where we run the application from. Basic setup: Application class files and Example 1: Example 2: I'm not sure if this is Cloud or Boot, but this is the only issue i still see open, so I started here. Is this something expected, or should I try fleshing out an example to provide? Edit - further trace logging out of ConfigDataEnvironment makes me think this is definitely a boot issue. It appears that the application.yml is being read twice if it is both in your current directory and also your classpath ( |
Describe the bug
When we add
spring.config.import
inapplication.yml
of an application'ssrc/main/resources
vs the same property is added as-D
parameter during the start up of the application, the behavior changes in terms of property order.Sample
A test case is added namely
ServerMyTestApplicationTests
underspring-cloud-config/spring-cloud-config-sample/src/test/java
(https://github.com/nagsuchandra/spring-cloud-config.git) and it's methodcontextLoads
shows the issue. There is documentation added to the source file .Error case:
application.yml has the following
Now if we run the test
ServerMyTestApplicationTests.contextLoads
, the property sources are as follows.application.yml does NOT have the spring.config.import in there and -Dspring.config.import is passed in
Config data files ordering gets reversed if
application.yml
hasspring.config.import
defined in it , but -D maintains the ordering in the right precedence.The text was updated successfully, but these errors were encountered: