ConfigurationPropertiesRebinder doesn't rebind properties for a bean which was created during bootstrap phase
Bug description
Version of spring-cloud-commons: 3.1.5 (in lower versions of spring-cloud-commons this bug doesn't occur) Version of spring-boot: 2.7.9 (irrelevant)
When a bean using @ConfigurationProperties is created during bootstrap phase with values taken from bootstrap.yaml file, then the values of this bean's fields are not updated with properties fetched using spring-cloud.
Sample
I've created a repository which reproduces this bug: https://github.com/pitagoras3/spring-cloud-context-bug.
In this project, you can find a test SpringCloudContextBugApplicationTests.shouldNotFailToUpdateApplicationPropertiesBean which fails, when springCloudCommons version is >= 3.1.5.
Where is the problem?
After some debugging I've found out that rebind method in ConfigurationPropertiesRebinder had changed between versions 3.1.4 and 3.1.5. In my opinion the bug which I have described might be a side-effect of this specific change. In 3.1.5 version of spring-cloud-context my IncorrectProperties bean used in test is never destroyed and initialized again (as it was in version 3.1.4).