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
Unable to autowire concrete classes when java config methods return interface [SPR-11046] #15673
it doesn't work with Spring 4. Instead, you get a NoSuchBeanDefinitionException stating that there are no beans qualifying for type RetrySampleItemWriter (RetrySampleItemWriter implements ItemWriter). This worked in Spring 3.2.
We generally recommend to declare the most specific dependency as the return type of a factory method, i.e. as specific as the injection points declare it.
Nevertheless, if it worked before, it should still work. Like the other two issues, this is a side effect of our generic-type-aware autowiring algorithm...
Fixed through only checking the method return type constraints if it is actually sufficiently expressive for the required dependency type: In other words, if the match only works against the already created singleton instance but not against the factory method return type, we skip a generic type match check for the factory method signature.
That said, please usually make the factory method return type as specific as possible. That never hurts and makes things work in case of the target bean instance not having been created yet as well.
Activity
spring-projects-issues commentedon Oct 30, 2013
Juergen Hoeller commented
We generally recommend to declare the most specific dependency as the return type of a factory method, i.e. as specific as the injection points declare it.
Nevertheless, if it worked before, it should still work. Like the other two issues, this is a side effect of our generic-type-aware autowiring algorithm...
Juergen
spring-projects-issues commentedon Oct 30, 2013
Juergen Hoeller commented
Fixed through only checking the method return type constraints if it is actually sufficiently expressive for the required dependency type: In other words, if the match only works against the already created singleton instance but not against the factory method return type, we skip a generic type match check for the factory method signature.
That said, please usually make the factory method return type as specific as possible. That never hurts and makes things work in case of the target bean instance not having been created yet as well.
Juergen