Skip to content

EnvironmentChangeEvent is published before @ConfigurationProperties beans are rebound #3105

@david0

Description

@david0

Describe the bug
When a configuration property is updated via the /actuator/env endpoint, the EnvironmentChangeEven is fired. However, any component listening for this event and a @ConfigurationProperties-based-bean will see the old value of the property, not the updated one. The new value is correctly reflected in the bean after the event handling is complete.

This behavior is counter-intuitive and can lead to bugs, as the purpose of the event is to signal a change in the environment, yet the updated values are not accessible within the event's scope.

Sample
I have created a demo project to reproduce this bug: https://github.com/david0/spring-cloud-mre-dynamic-config-changes

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