title: Dependency Injection to generics spring
body: <p>Is it possible to Inject generic in spring boot like below? </p>
  
  <pre><code>public interface A &lt;T&gt; extends ElasticsearchRepository&lt;T, Long&gt; {
  
  }
  
  public class B {
      @Autowired
      private A&lt;Object&gt; a;
  
  }
  </code></pre>
  
  <p>following code give this error</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genericElasticRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unable to obtain mapping metadata for class java.lang.Object!
  </code></pre>
  
  <p>is there any alternatives to generic? I dont want to write for interfaces for all type of T</p>
  
  <p>thanks in advance</p>
  
  <p>updated</p>
  
  <p>There was not any problem with generics in my code I guess it is rather repositories has something to do with concrete class. JpaRepository or ElasticsearchRepository does not allow to pass generic they need concrete type I dont know why </p>