Restore ability to override bean definition names in DefaultListableBeanFactory subclass [SPR-12667] #17266
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: declined
A suggestion or change that we don't feel we should currently apply
type: enhancement
A general enhancement
Martin Lippert opened SPR-12667 and commented
There are changes made to DefaultListableBeanFactory that can cause subclasses to break:
965bea7
The problem is that inside method "doGetBeanNames..." the access of the bean definition names is changed from calling "getBeanDefinitionNames" to the direct field access. This breaks subclasses that have overridden "getBeanDefinitonNames" in order to do special things.
This is the case in Spring IDE, where there is a subclass of DefaultListableBeanFactory, which doesn't track the bean definition names itself, but delegates that to a BeanDefinitionRegistry object. This delegation is implemented for the BeanDefinitionRegistry methods in DefaultListableBeanFactory. I am not sure whether this is the optimal way to do this or if there is a more elegant way, but I tried to avoid to implement the methods of ListableBeanFactory by re-using them from the DefaultListableBeanFactory. That works if the implementation of DefaultListableBeanFactory is consequently calling the methods of BeanDefinitionRegistry instead of using fields directly. But I am open to other ideas, of course.
Affects: 4.1.2, 4.1.3, 4.1.4
Issue Links:
The text was updated successfully, but these errors were encountered: