title: Spring Boot WebFluxTest test, failed to instantiate repository, specified class is an interface
body: <p>I am writing the integration tests with <code>@WebFluxTest</code> for my <code>@RestController</code>.
  Here are my classes:</p>
  <pre><code>@RestController
  @RequestMapping(&quot;/usager&quot;)
  public class UsagerController {
  
      @Autowired
      private UsagerService usagerService;
  
      @GetMapping
      public Usager getUsager() {
          return usagerService.create();
      }
  
  }
  </code></pre>
  <pre><code>@Service
  public class UsagerService implements CrudService&lt;Usager, Integer&gt; {
  
      @Autowired
      private UsagerRepository usagerRepository;
  
      @Override
      public JpaRepository&lt;Usager, Integer&gt; getRepository() {
          return usagerRepository;
      }
  
      @Override
      public Usager create() {
          return new Usager();
      }
  
  }
  </code></pre>
  <pre><code>@Repository
  public interface UsagerRepository extends JpaRepository&lt;Usager, Integer&gt;, JpaSpecificationExecutor&lt;Usager&gt; {
  
  }
  </code></pre>
  <pre><code>@ExtendWith(SpringExtension.class)
  @WebFluxTest(UsagerController.class)
  @Import({ UsagerService.class, UsagerRepository.class })
  @Tag(TestCase.INTEGRATION)
  public class UsagerControllerIT {
  
      @Autowired
      private WebTestClient wtc;
  
      @Test
      public void getUsager_returnUsager() {
          ResponseSpec rs = wtc.get().uri(&quot;/usager&quot;).exchange();
  
          rs.expectStatus().isOk();
          rs.expectHeader().contentType(MediaType.APPLICATION_JSON);
          rs.expectBody(Usager.class).isEqualTo(new Usager());
      }
  
  }
  </code></pre>
  <p>I get the following exception:</p>
  <pre><code>Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.dsi.bibliosys.biblioback.repository.UsagerRepository]: Specified class is an interface
  </code></pre>
  <p>I don't understand why Spring can't inject the repository.
  Does somebody have an idea ?</p>
  <hr />
  <p>I tried another approach using <code>@SpringBootTest</code>. Here is my new test class :</p>
  <pre><code>@ExtendWith(SpringExtension.class)
  @SpringBootTest
  @Tag(TestCase.INTEGRATION)
  public class UsagerController02IT {
  
      @Autowired
      private UsagerController usagerController;
  
      @Test
      public void getUsager_returnUsager() {
          WebTestClient wtc = WebTestClient.bindToController(usagerController).build();
  
          ResponseSpec rs = wtc.get().uri(&quot;/usager&quot;).exchange();
  
          rs.expectStatus().isOk();
          rs.expectHeader().contentType(MediaType.APPLICATION_JSON);
          rs.expectBody(Usager.class).isEqualTo(new Usager());
      }
  
  }
  </code></pre>
  <p>I get this exception:</p>
  <pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.dsi.bibliosys.biblioback.controller.UsagerController': Unsatisfied dependency expressed through field 'usagerService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.dsi.bibliosys.biblioback.service.entity.UsagerService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  </code></pre>
  <p>I don't understand why <code>UserService</code> is not available in the application context.</p>
  <p>Thanks for your help.</p>