spring-cloud / spring-cloud/spring-cloud-commons
Change detection on refreshEnvironment not working properly with configtree
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 751
- Forks
- 744
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
Spring Boot: 4.0.5
Spring Cloud: 2025.1.1
Related issue: https://github.com/spring-projects/spring-boot/issues/50181
Describe the bug
When using configtree: for properties and using ContextRefresher#refreshEnvironment(), all properties from configtree property sources will be returned as changed, even if the actual value did not.
The reason is that ContextRefresher#changes(Map, Map) checks for equality, but the returned PropertyFileContent does not implement equals/hashCode.
After posting the issue in the Spring Boot repo, the response was that this should be raised here.
Sample
Example project: https://github.com/schosin/spring-cloud-commons-1687
A Spring Boot application with spring-cloud-context using this configuration, and the directory containing atleast one file will trigger the issue with the auto configured ContextRefresher.
spring:
config:
import:
- configtree:some/path/to/directory/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ContextRefresher#refreshEnvironment() and changes(Map, Map) in spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java, then inspect Spring Boot's ConfigTreePropertySource.PropertyFileContent. Reproduce the behavior with the linked sample project and configtree import; done means refreshEnvironment reports only properties whose actual values changed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100