Autowiring unable to find generic dependency [SPR-11529] #16154
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: regression
A bug that is also a regression
Milestone
Jair da Silva Ferreira Júnior opened SPR-11529 and commented
Hi,
I believe I found an issue with autowiring and generics.
I can't really tell if this issue is a duplicate of #16096, so I decided to report it anyway. The main diference with this issue is that I use the
@Service
annotation instead of a factory method to create the GenericInterface1Impl spring bean.I attached a simple eclipse example project to show you the issue.
Here is my "application-context.xml" file:
I have 2 classes: "GenericInterface1Impl" and "GenericInterface2Impl".
"GenericInterface1Impl" depends on an implementation of "GenericInterface2".
The issue is: spring can't find a qualifying bean for the attribute "GenericInterface1Impl.gi2" even though there's a suitable "GenericInterface2" implementation (GenericInterface2Impl) in the application context.
The exact same code works perfectly with spring version 3.2.8 but fails with spring version 4.0.2. You can easily change the spring version to 3.2.8 in "pom.xml" to verify that.
Here's the exception stack trace:
Affects: 4.0.2
Attachments:
Issue Links:
The text was updated successfully, but these errors were encountered: