[spring] Spring can you autowire inside an abstract class?

Spring is failing to autowire my object? Is it possible to autowire an object within an abstract class. Assume all schemas are supplied in application-context.xml

Question: What annotation should be on the base and extending classes (if any) @Service @Component?


abstract class SuperMan {

    private DatabaseService databaseService;

    abstract void Fly();

    protected void doSuperPowerAction(Thing thing) {

        //busy code



Extending class

public class SuperGirl extends SuperMan {

    public void Fly() {
        //busy code

    public doSomethingSuperGirlDoes() {

        //busy code




<context:component-scan base-package="com.baseLocation" />

This question is related to spring abstract-class autowired

The answer is

I have that kind of spring setup working

an abstract class with an autowired field

public abstract class AbstractJobRoute extends RouteBuilder {

    private GlobalSettingsService settingsService;

and several children defined with @Component annotation.

Similar questions with spring tag:

Similar questions with abstract-class tag:

Similar questions with autowired tag: