I have 2 class hierarchies:
* ClassA * ClassB * AbstractClass * Class1 * ... * Class5 AbstractClass autowires ClassA as follows:
public abstract class AbstractClass { @Autowired protected ClassA classA; } Now I would like to inject ClassA into Class1, .., Class4 implementations but ClassB into Class5. I'm aware that I can do that by injecting directly in implementing classes rather than in abstract class (as in Similar Question) but that means that I have to have the same field declared not once but five times. Additionally if I want to use this field in abstract class I would have to enforce creating getter in implementing class and use it to get that service. It works but it doesn't seem to me like right way to do it.