Skip to content

Change detection on refreshEnvironment not working properly with configtree #1687

@schosin

Description

@schosin

Spring Boot: 4.0.5
Spring Cloud: 2025.1.1
Related issue: spring-projects/spring-boot#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/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions