When I'm working on write some spring code, I'm using spring 4 with class and annotation-config. I have declared a bean implements an interface as a component. And I'm trying to make another bean to depends on it with its interface time. But it doesn't work because spring throws an error with no bean found in that name. I think it may because depends on is only work with concretive class auto wire, but I don't know why it set in this way? Is anyone could explain why depends on annotation don't allow type auto wire to an interface?
The simple sample code is like this
@Component
class A implement B{
}
@Component
@DependsOn("B")
class C {
}
the code above cannot work unless I change
@DependsOn("B")
to @DependsOn("A")