Open dyleph opened 1 year ago
If you move the spring.config.import
statement into the application.yaml
instead of an environment variable does it work?
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Hey, sorry about late.
It works when I added spring.config.import
into application.yml
file
This is because when you have spring.config.import in an environment variable spring boot tries to load that configuration before it has even loaded your application.yaml, so it does not know the username or password. We made some changes recently so that the config server takes advantage of spring boots 2 part config data loading so that is why you might see this after the upgrade.
Somewhat slightly related. I'm using Spring Boot/Cloud in Docker with the application getting the URL as environment variable, while the credentials are set via a combination of Docker secrets and configtree. With the changed loading mechanism, this sentence from the docs has become extremely important:
Locations will be processed in the order that they are defined, with later imports taking precedence.
Notice the order in my (now) working client Compose environment snippet:
SPRING_CONFIG_IMPORT: configserver:${CONFIG_SERVER_URL:-http://config-server:8888},configtree:/run/secrets/
(Previously it was reversed. 🤦)
Hi Spring Cloud team,
I am going to upgrade Spring cloud from 2022.0.2 to 2022.0.4. And I got an issue while starting my application.
Spring boot: v3.1.1 Spring cloud: v2022.0.4
In application.yml:
In helm-chart/dev.values.yaml:
Here is the error log:
It looks like the application couldn't get
username
in application.yml. I was trying to set it as an environment variableSPRING_CLOUD_CONFIG_USERNAME
in helm-chart/dev.values.yml, and it starts successfully.Could you please help to check this case? In new Spring cloud version, do we have to set SPRING_CLOUD_CONFIG_USERNAME as an environment variable on each deployed environment? For example, I have 2 environments of
dev
andprod
Thanks for your help!