title: Configuring database for integration tests in micronaut
body: <p>I am trying to write an integration test in micronaut.</p>
  
  <p>I have a controller class:</p>
  
  <pre><code>@Controller("/hello")
  public class HelloController {
  
      @Inject
      private HelloRepository helloRepository;
  
      @Get("/")
      public HttpResponse get() {
          return HttpResponse.ok(helloRepository.findAll());
      }
  }
  </code></pre>
  
  <p>I am trying to write an integration test for it like:</p>
  
  <pre><code>@MicronautTest
  public class HelloControllerSpec {
  
      @Inject
      EmbeddedServer embeddedServer;
  
     @BeforeEach
      void setUp() {
          initMocks(this);
      }
  
      @Test
      public void testIndex() throws Exception {
          try(RxHttpClient client = embeddedServer.getApplicationContext().createBean(RxHttpClient.class, embeddedServer.getURL())) {
             client.toBlocking().exchange("/hello").status();
          }
      }
  }
  </code></pre>
  
  <p>But I keep getting the error:</p>
  
  <pre><code> No backing RepositoryOperations configured for repository. Check your configuration and try again  
  </code></pre>
  
  <p>My application.yml file that I put under "src/test/java/resources/" has the following datasource implementation:</p>
  
  <pre><code>datasources:
     default:
        url: jdbc:h2:mem:devDb
        driverClassName: org.h2.Driver
        username: sa
        password: 'sa'
        schema-generate: CREATE_DROP
        dialect: H2
  jpa:
     default:
        packages-to-scan:
           - 'com.myproject.project'
        properties:
           hibernate:
              hbm2ddl:
                 auto: update
              show_sql: true
  
  </code></pre>
  
  <p>I have also included this in my build.gradle file</p>
  
  <pre><code>runtime 'com.h2database:h2'
  </code></pre>
  
  <p>Is there any way to solve this?</p>
  
  <p>Edit: This is my repository class</p>
  
  <pre><code>@Repository
  public interface HelloRepository extends CrudRepository&lt;BufferConditionEntity, Long&gt; {}
  
  </code></pre>