Spring's autowire by type and inheritance
Posted Tue, 20 Feb 2007 13:22:55 GMT
It seems that if a Spring context contains a class (A) and its superclass (B), the autowire by type for the superclass (B) fails.
That’s because when it does the lookup for beans of type B, the context returns both B and A. It’s not wrong in any way, it’s probably exactly the right thing to do, but it somehow makes it a bit trickier to do tests well, for me now anyway….
Or, may be one should never instantiate classes which are not leafs of the hierarchy tree. Should may be all classes that can be extended be abstract?…. All non-final classes abstract…hm… weird thoughts, don’t pay too much attention…..
