title: Spring can you autowire inside an abstract class?
body: <p>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</p>
  
  <p>Question: What annotation should be on the base and extending classes (if any) @Service @Component?</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>abstract class SuperMan {
  
      @Autowire
      private DatabaseService databaseService;
  
      abstract void Fly();
  
      protected void doSuperPowerAction(Thing thing) {
  
          //busy code
  
          databaseService.save(thing);
  
      }
  }
  </code></pre>
  
  <p><strong>Extending class</strong></p>
  
  <pre><code>public class SuperGirl extends SuperMan {
  
      @Override
      public void Fly() {
          //busy code
      }
  
      public doSomethingSuperGirlDoes() {
  
          //busy code
  
          doSuperPowerAction(thing)
  
      }
  </code></pre>
  
  <p><strong>application-context.xml</strong></p>
  
  <pre><code>&lt;context:component-scan base-package="com.baseLocation" /&gt;
  &lt;context:annotation-config/&gt;
  </code></pre>