Destroy and initialize beans within the correct context. Fixes #1158 (#1160)

Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
This commit is contained in:
Ryan Baxter
2022-10-25 09:05:18 -04:00
committed by GitHub
parent 6a03d2b201
commit 86c44de855
2 changed files with 30 additions and 23 deletions

View File

@@ -71,12 +71,12 @@ public class ConfigurationPropertiesRebinderIntegrationTests {
@Test
@DirtiesContext
public void testRefreshInParent() throws Exception {
then(this.config.getName()).isEqualTo("main");
then(this.config.getName()).isEqualTo("parent");
// Change the dynamic property source...
TestPropertyValues.of("config.name=foo").applyTo(this.environment);
// ...and then refresh, so the bean is re-initialized:
this.rebinder.rebind();
then(this.config.getName()).isEqualTo("foo");
then(this.config.getName()).isEqualTo("parent");
}
@Test