Phil Webb opened SPR-11480 and commented
Spring Boot was recently updated to consider FactoryBean generics. This could be ported into BeanFactoryUtils
if useful.
See https://github.com/spring-projects/spring-boot/pull/355 & https://github.com/spring-projects/spring-boot/commit/5d591edbf81b271fe2b5152f883bc14cb7c4f99c
Affects: 4.0.2
Issue Links:
- #16146 Introspect factory method return type for type variable resolution at injection points
- #18558 Improve target bean type detection for FactoryBeans
- #16461 HttpInvokerProxyFactoryBean and co do not reliably expose correct type when declared via @Bean
0 votes, 5 watchers
Comment From: spring-projects-issues
Juergen Hoeller commented
Aren't we talking about ListableBeanFactory's getBeansOfType here? BeanFactoryUtils only really contains an algorithm for accumulation over a factory hierarchy...
Juergen
Comment From: spring-projects-issues
Phil Webb commented
Right, my mistake. We call BeanFactoryUtils
, but the enhancement should be in the ListableBeanFactory
implementation. I have updated the description.
Comment From: spring-projects-issues
Juergen Hoeller commented
To the best of my attempts to reproduce this, it all works fine after context refresh. So I suppose we're only really talking about introspection of factory method return types before the containing Class has been resolved? This is an assumption in the current getTypeForFactoryBean algorithm, after all: It only starts looking at factory method return type signatures for bean definitions with the bean class name already resolved to a Class...
Juergen
Comment From: jhoeller
Closing this in favor of the more general #18558. Optimized FactoryBean resolution is still a topic to be investigated but I don't see any specific action we can take for this ticket here.