title: How to create bean for spring data jpa repository?
body: <pre class="lang-java prettyprint-override"><code>@Repository
  public interface MyRepository extends CrudRepository&lt;Custom, Long&gt; {}
  </code></pre>
  <pre class="lang-java prettyprint-override"><code>@Service
  @RequiredArgsConstructor
  public class MyServiceImpl implements MyServiceInterface {
   
   private final MyRepository repository;
  }
  </code></pre>
  <p>I use test configuration with instructions for bean construction for testing.<br />
  How to create <code>@Bean</code> for <code>MyRepository interface</code>?</p>
  <pre class="lang-java prettyprint-override"><code>@TestConfiguration
  @EnableJpaRepositories(basePackages = &quot;com.example.app&quot;)
  public class TestBeans {
  
   @Bean 
   MyServiceInterface getMyService() {
    return new MyServiceImpl(getMyRepository()); 
   }
  
   @Bean 
   MyRepository getMyRepository() {
    return null; // what should be here?
   }
  }
  </code></pre>