title: Spring 3.2 Autowire generic types
body: <p>So I have a number of generics in Spring 3.2 and ideally my architecture would look something like this.</p>
  
  <pre><code>class GenericDao&lt;T&gt;{}
  
  class GenericService&lt;T, T_DAO extends GenericDao&lt;T&gt;&gt;
  {
      // FAILS
      @Autowired
      T_DAO;
  }
  
  @Component
  class Foo{}
  
  @Repository
  class FooDao extends GenericDao&lt;Foo&gt;{}
  
  @Service
  FooService extends GenericService&lt;Foo, FooDao&gt;{}
  </code></pre>
  
  <p>Unfortunately with multiple implementations of the generics the autowiring throws an error about multiple matching bean definitions. I assume this is because <code>@Autowired</code> processes before type erasure. Every solution I've found or come up with looks ugly to me or just inexplicably refuses to work. What is the best way around this problem?</p>