title: Use abstract Spring bean as constructor-arg
body: <p>We have a hierarchy of handler classes in our codebase which implement a kind of chain-of-responsibility principle. There is an abstract parent class and it is extended by several child classes, which also receive the abstract in their constructor</p>
  
  <pre><code>public abstract class AbstractHandler {
    public AbstractHandler(final AbstractHandler next, final PropertyName propertyName) {
      this.next = next;
      this.propertyName = propertyName;
    }
    ...  
  
  public class OneConcreteChildHandler extends AbstractHandler {
    public OneConcreteChildHandler(final AbstractHandler next) {
      super(next, PropertyName.OneConcreteChild);
    }
    ...
  </code></pre>
  
  <p>We would now need to inject an instance of one of the concrete child classes into a newly implemented service class, and we should configure this in XML. We can configure an abstract bean for the abstract parent class, but this one then does not seem to be allowed to be used as constructor-arg for the concrete child bean</p>
  
  <pre><code>&lt;bean id="abstractHandler" abstract="true" class="...AbstractHandler" /&gt;
  
  &lt;bean id="oneConcreteChildHandler" class="...OneConcreteChildHandler" parent="abstractHandler"&gt;
      &lt;constructor-arg ref="abstractHandler"/&gt; //"abstract bean can not be used here"
  &lt;/bean&gt;
  
  &lt;bean id="someService" class="...SomeService"&gt;
      &lt;constructor-arg ref="oneConcreteChildHandler"/&gt;
      ...
  </code></pre>
  
  <p>Is there any way to overcome this? The handler class hierarchy is legacy code and we are not able to modify their sources at this point.</p>