spring-cloud / spring-cloud/spring-cloud-commons

Change detection on refreshEnvironment not working properly with configtree

Open
#1,687 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.