title: Injecting Spring Data Repositories in Junit 5 Tests
body: <p>I am trying to inject a spring data repository in a Junit 5 test but I am getting </p>
  
  <pre><code>No qualifying bean of type 'com.xxx.core.security.datastore.AccountsRepository' available: expected at least 1 bean which qualifies as autowire candidate
  </code></pre>
  
  <p>here is the test </p>
  
  <pre><code>package com.xxx.core.security.datastore;
  
  import org.junit.jupiter.api.Assumptions;
  import org.junit.jupiter.api.BeforeEach;
  import org.junit.jupiter.api.Test;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
  
  @SpringJUnitConfig
  class AccountsRepositoryTest {
  
  
      @Autowired
      AccountsRepository accountsRepository;
  
      @BeforeEach
      void setUp() {
          Assumptions.assumeTrue(true); // how to get spring profile ! 
      }
  
      @Test
      public void name() {
  
      }
  }
  </code></pre>
  
  <p>And here is my repo </p>
  
  <pre><code>package com.xxx.core.security.datastore;
  
  import com.checkit.core.security.datastore.model.Account;
  import org.springframework.data.repository.CrudRepository;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public interface AccountsRepository extends CrudRepository&lt;Account,Long&gt; {
      Account findByName(String name);
  }
  </code></pre>
  
  <p>When I run the application spring seems to wire everything </p>