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
spring.config.import configuration clashes with spring.cloud.config.enabled #1877
Comments
What version of Spring Cloud are you using? Can you provide the error? |
Spring Cloud 2020.0.2 It's not an error that is thrown, only that the behavior is not the expected one. When I disable the cloud config client, I expect the config server not to be called at all, which is not the case. |
I created a small project to demonstrate the issue. |
the problem is that you have if you move the property to application.properties, or use an environment variable, it works as expected. @spencergibb @philwebb is this behavior intended? Should we look at any profile specific configuration properties and apply those before fetching configuration? |
Based on the observed behavior, your assessment is valid. However, even if I set
In that case, this is the final configuration file:
|
The problem doesn't get worse IMO, that is the expected behavior. Boot does not know what Lets take a step back... Why disable spring cloud config in the first place? With the |
Because that This is why we need a Moreover, what is then the purpose of having the ability to disable the client config if that is not working?! Basically, that flag becomes useless. |
all spring.config.import entries are evaluated. They do not behave like normal properties that can be overridden. Properties in a profile can not, by definition, influence an import in the default profile. If you don't want import in default, the only option is to not put an import there. |
OK. This, indeed, is the path we should have thought of. The slightly change is that we have to enable the config client and provide the config server URL thgrough environment variables for the targeted profiles and have the client config disabled on the default configuration. This is the other way around compared to the old implementation where we had a spring config server set for the default profile and config client disabled for some particular profiles, like dev. After reading the documentation again for the |
@nucatus let us know if there is anything we can do to make things clearer. I will close this for now. |
Just spent two days trying to figure out why the dockerfile command line argument does not override spring.config.import specified in application.properties.
this migration has been very painful =_= |
Leaving my stackoverflow answer here in case someone stumbles into this issue via google: https://stackoverflow.com/questions/68702479/disable-config-service-client-activated-with-spring-config-import-in-springboott/69739888#69739888 There are workarounds but the situation of I for one would wish that Spring Cloud Config would still register its
This is not working because of the aformentioned missing variable resolution. This issue is creating a lot of headaches for our production environment at the moment. |
Hi Ryan, thank you very much. I was having problem with this, so I put the 'spring.config.import' first than any property and that solved it for me. I am using Spring 3.1.1 |
Observed behaviour
A
spring.config.import
config property is set tooptional:configserver:http://myconfigserver:5656
in a main configuration fileapplication.properties
. In theapplication-dev.properties
config file, the propertyspring.cloud.config.enabled
is set to false, since we don't require any property to be loaded from the remote config server on the dev profile. However, the observed behavior is thatConfigServerConfigDataLoader
implementation doesn't take into account that setting and is going to try to pull that configuration from the remote server. If the connection fails, it will check for thefail-fast
andisOptional
flags and make a decision based on that outcome.Intended behavior
If the
spring.cloud.config.enabled
property is set tofalse
,ConfigServerConfigDataLoader
should not even try to connect to the remote server and return as soon as possible.The text was updated successfully, but these errors were encountered: