You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider generics when predicting FactoryBean types #23338
It would be beneficial if we could consider generics when trying to predict the result of FactoryBean.getObjectType(). We currently have difficulty with getBeanNamesForType if the bean being considered is a factory bean and we don't want to initialize it early.
It's possible that we can still deduce the type using generics of the factory method, or the class itself. For example:
We have logic to do this already as part of DefaultListableBeanFactory.getTypeForFactoryBean, however, in its current form that method may also cause early initialization of the bean.
I found an annoying edge case that means any @Configuration class picked up by component scanning won't be detected correctly. This is because the bean definition has a String type not a Class type and hasBeanClass() return false.
Activity
Consider generics for predicting FactoryBean types
Support FactoryBean bean definition attributes
Support FactoryBean bean definition attributes
Resolve factoryBeanClass if necessary
philwebb commentedon Jul 31, 2019
I found an annoying edge case that means any
@Configurationclass picked up by component scanning won't be detected correctly. This is because the bean definition has aStringtype not aClasstype andhasBeanClass()returnfalse.I think I have a fix in this branch
jhoeller commentedon Jul 31, 2019
Resolving a
FactoryBeanclass along the lines of that branch looks ok to me...Consider generics for predicting FactoryBean types
Resolve factoryBeanClass if necessary