title: Is it possible to create a generic repository that extends other interfaces that extend Spring's CrudRepository?
body: <p>Here are the details:</p>
  
  <p>I have multiple Models in my application, each model has a repository that extends Spring's <code>CrudRepository</code>.</p>
  
  <p>For example:</p>
  
  <ul>
  <li><p><code>EyeColorModel</code> has repository <code>interface EyeColorRepository extends CrudRepository&lt;EyeColor, Long&gt;</code></p></li>
  <li><p><code>HairColorModel</code> has repository <code>interface HairColorRepository extends CrudRepository&lt;HairColor, Long&gt;</code></p></li>
  <li><p><code>StateModel</code> has repository <code>interface StateRepository extends CrudRepository&lt;State, Long&gt;</code></p></li>
  <li><p>and so on ...</p></li>
  </ul>
  
  <p>I would like to create a generic <code>MyApplicationRepository</code> that extends all of my individual repositories so that I need only create a single instance of <code>MyApplicationRepository</code> instead of creating multiple instances of my individual repositories.</p>
  
  <p>I tried this:</p>
  
  <pre><code>public interface MyApplicationRepositoryInterface extends
      EyeColorRepository,
      HairColorRepository,
      StateRepository {
  }
  
  
  public class MyApplicationRepository implements MyApplicationRepositoryInterface {
  }
  </code></pre>
  
  <p>However, when I try to extend all of my individual repositories in <code>MyApplicationRepositoryInterface</code> I get this error:</p>
  
  <pre><code>CrudRepository cannot be inherited with different arguments: &lt;com.myapp.Models.EyeColor, java.lang.Long&gt; and &lt;com.myapp.Models.HairColor, java.lang.Long&gt;
  </code></pre>
  
  <p>So is there a way to do what I would like to do, or am I stuck with instantiating instances of all my model repositories?</p>