title: Can't get @Component to be inherited in Spring?
body: <p>In my project there's a common base class that all client classes extend. This has an @Autowired field that needs to be injected by Hibernate. These are all grouped together in another class that has an @Autowired collection of the base class. </p>
  
  <p>In order to reduce boilerplate for client code I'm trying to get @Component inherited. With @Component not doing this by default (apparently <a href="http://forum.springsource.org/showthread.php?45559-Component-Inherited-problems-with-test-stub-subclasses-and-autowiring-by-type" rel="noreferrer">it used to though</a>), I created this workaround annotation</p>
  
  <pre><code>@Target(ElementType.TYPE)
  @Retention(RetentionPolicy.RUNTIME)
  @Component
  @Inherited
  public @interface InheritedComponent {
  }
  </code></pre>
  
  <p>... and annotated the base class with it. Its not pretty but I hoped it would work. Unfortunately it didn't, which really confuses me as @Inherited should make it work</p>
  
  <p>Is there any other way to get @Component inherited? Or do I just have to say that any class that extends the base class needs this boilerplate?</p>