Leniently tolerate late bean retrieval during destroySingletons()

Closes gh-22526
Closes gh-29730
This commit is contained in:
Juergen Hoeller
2024-03-04 17:21:02 +01:00
parent 138e7a0e07
commit b5ca646431
2 changed files with 22 additions and 22 deletions

View File

@@ -85,12 +85,11 @@ public class Service implements ApplicationContextAware, MessageSourceAware, Dis
Assert.state(applicationContext.getBean("messageSource") instanceof StaticMessageSource,
"Invalid MessageSource bean");
try {
// Should not throw BeanCreationNotAllowedException on 6.2 anymore
applicationContext.getBean("service2");
// Should have thrown BeanCreationNotAllowedException
properlyDestroyed = false;
}
catch (BeanCreationNotAllowedException ex) {
// expected
properlyDestroyed = false;
}
});
thread.start();