Closed as not planned
Closed as not planned
Description
Juergen Hoeller opened SPR-11521 and commented
In Spring Framework 4.0, we take the factory method return type into account for injection targets (i.e. the right-hand side of an assignment) but not for injection points themselves (i.e. the left-hand side). As a consequence, type variables in @Autowired
fields or method parameters are not getting resolved if the only place where they are being substituted is the return declaration of the factory method that creates the containing object. See the provided test scenario for #16096 for an example.
We should revisit this for 4.1, introspecting the factory method return type if the containing class itself doesn't substitute the type variable anywhere in its hierarchy.
Affects: 4.0.2
Issue Links:
- Autowiring unable to find generic dependency in case of nested unresolved type variable [SPR-11471] #16096 Autowiring unable to find generic dependency in case of nested unresolved type variable
- Inferring an ApplicationListener's event type from a lambda or method reference [SPR-10675] #15303 Inferring an ApplicationListener's event type from a lambda or method reference
- getBeanNamesForType should consider FactoryBean generics for early introspection of config classes as well [SPR-11480] #16105 getBeanNamesForType should consider FactoryBean generics for early introspection of config classes as well
- Collection autowiring does not resolve field-level type variable against containing class [SPR-15160] #19726 Collection autowiring does not resolve field-level type variable against containing class