title: How to retrieve spring data repository instance for given domain class?
body: <p>Given the list of all spring data repositories in some class <code>Bar</code>:</p>
  
  <pre><code>@Autowired
  private List&lt;Repository&gt; repositories;
  </code></pre>
  
  <p>How can I find the repository for an existing domain class <code>Foo</code> in the above list?</p>
  
  <p>Assuming that the following exists:</p>
  
  <pre><code>@Entity
  public class Foo {
    ...
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>public interface FooRepository extends JpaRepository&lt;Foo, String&gt; {}
  </code></pre>