Describe the bug
Integration with importing aka spring.config.import
seems broken since Spring Boot 2.5.1 with newest spring-cloud-config 3.0.4.
Sample
Actually I don't know on which side the bug is. Here:
spring-config.zip
you can find example based on tutorial. You should unpack zip at /tmp/spring-cloud
and then run server + client. Client should be run with dev
profile. Once you call endpoint http://127.0.0.1:8080/message you should see Hello Dev!
. With Spring Boot 2.5.0 it works as expected. However after changing build.gradle
of client to:
id 'org.springframework.boot' version '2.5.1'
Configurations are no longer fetched from the server. So you can see only the default value Hello default
on http://127.0.0.1:8080/message
You can also verify if property message
was fetched with help of:
http://127.0.0.1:8080/actuator/env/message
This bug was also reported at spring-cloud-config: https://github.com/spring-cloud/spring-cloud-config/issues/1913
Comment From: wilkinsona
The change in behaviour is due to https://github.com/spring-projects/spring-boot/issues/26753. The spring.config.import
will work if you move it into application.properties
.
Comment From: wyhasany
@wilkinsona that's correct. It fixes my case. I think it should be a bit better described maybe in docs, but definitely here: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.5-Release-Notes Anyway it solves my issue. Thanks a lot 👍
Comment From: wyhasany
What should I do if I use different URLs of configserver for different environments but I don't use a default one?
Comment From: kaliy
Hi, I have the same issue, I described it in #26858 because I thought it is related to my case: https://github.com/spring-projects/spring-boot/issues/26858#issuecomment-863897701
I think this is a really breaking change that shouldn't be part of the minor release.
Comment From: wilkinsona