title: Injection into generic parametrized property in Spring
body: <p>What is the best workaround for injection into generic parametrized property?</p>
  
  <p>Simple example from <a href="https://jira.springsource.org/browse/SPR-5561" rel="nofollow">record in Spring Jira</a>:</p>
  
  <pre><code>@Component
  public abstract class AbstractFoo&lt;V extends Bar&gt; {
  
     @Autowired
     protected V bar;
  }
  
  @Component
  public ConcreteFoo1 extends AbstractFoo&lt;ConcreteBar1&gt; {
  }
  
  @Component
  public ConcreteFoo2 extends AbstractFoo&lt;ConcreteBar2&gt; {
  }
  </code></pre>
  
  <p>When I have such abstract <code>AbstractFoo</code> class and try to determine Spring bean which should be injected through generecis (<code>ConcreteFoo1</code>, <code>ConcreteFoo1</code>) Spring throws exception such as:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'foo.ConcreteFoo1'
  Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: 
  No unique bean of type [bar.Bar] is defined: 
  expected single matching bean but found 2: [concreteBar1, concreteBar2]
  </code></pre>
  
  <p>I tested similar scenarion in Spring 3.2.1. 
  What is the best workaround for this problem?  </p>
  
  <p>This problem was reported at 10/Mar/09.<br>
  Why is this functionality still not implemented in Spring? Are there any complications preventing from solving this insufficiency?</p>