-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regressionA bug that is also a regression
Milestone
Description
While trying to upgrade to Spring 6.2.11 from Spring 6.2.10, I came upon an issue where the method DefaultListableBeanFactory::getBeanNamesForType(Class type) does not always return all the bean names for a type and its subtypes. The issue is easily reproducible with the following piece of code:
try (GenericApplicationContext context = new GenericApplicationContext()) {
context.refresh();
ConfigurableListableBeanFactory beanFactory = context
.getBeanFactory();
beanFactory.registerSingleton("FIRST", new Object());
String[] beanNames = beanFactory.getBeanNamesForType(Object.class);
beanFactory.registerSingleton("SECOND", new HashMap<String, Object>());
beanNames = beanFactory.getBeanNamesForType(Object.class);
System.out.println(Arrays.toString(beanNames));
}
The result with Spring 6.2.10/6.2.11 is:
[environment, systemProperties, systemEnvironment, applicationStartup, messageSource, applicationEventMulticaster, lifecycleProcessor, FIRST] - > "SECOND" is missing
Whereas with earlier version the array contains "SECOND" as well.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regressionA bug that is also a regression