ListableBeanFactory.getBeansOfType does not include null bean entries

Issue: SPR-17034
This commit is contained in:
Juergen Hoeller
2018-07-14 01:02:39 +02:00
parent 24a30baa2a
commit 680afa75d8
2 changed files with 11 additions and 2 deletions

View File

@@ -512,7 +512,9 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
for (String beanName : beanNames) {
try {
Object beanInstance = getBean(beanName);
result.put(beanName, (beanInstance instanceof NullBean ? null : (T) beanInstance));
if (!(beanInstance instanceof NullBean)) {
result.put(beanName, (T) beanInstance);
}
}
catch (BeanCreationException ex) {
Throwable rootCause = ex.getMostSpecificCause();