-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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
After upgrading Spring Boot from 3.1.5 to 3.2.0 properties from application.properties are missing #39940
Comments
@anvo1115 Can you please provide the config server application that works with the demo. I currently get "Connection refused". |
@philwebb , you don't need config-server application to run the test. To reproduce you just need to run DemoApplicationTests -> contextLoads test. |
That doesn't work for me, with or without adding the
Note that lack of The sample's also using 3.1.9-SNAPSHOT but this issue's title says that the problem only occurs with 3.2. Can you please provide a minimal sample that reproduces the problem without requiring any modifications? |
I will be able to update Demo after the release of spring-cloud/spring-cloud-config#2376 (comment) |
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. |
Please, check the attached demo project. I upgraded spring-cloud and spring-boot. |
Thanks for the sample @anvo1115. From a Spring Boot perspective I think this is working as designed. Any When you have: @SpringBootTest(properties = {"spring.config.import=optional:configserver:http://localhost:8065"}) Spring Boot will attempt to import from If you remove Likewise, if you did the following: @SpringBootTest(properties = {"spring.config.import=optional:configserver:http://localhost:8065", "my-property=foo"}) You'd also see I'm not sure why things changed when you upgraded dependencies. I don't think we've touched the area of code in Spring Boot that handles imports so I suspect it's something in Spring Cloud. As a fix, I would suggest updating your my-property=foo
myserver=http://therealserver.example.com:8065
spring.config.import=optional:configserver:${myserver} Then in your test do: @SpringBootTest(properties = { "myserver=http://localhost:8065" }) That way the |
Please, refer to spring-cloud/spring-cloud-config#2376
Can you check the case:
Take the demo from the Spring Cloud issue
Add to the test class DemoApplicationTests
Than you will see that the default value for myProperty was returned instead of value from application.properties.
Is it normal? It seems that earlier we didn't have this issue.
The text was updated successfully, but these errors were encountered: