micronautmicronaut-data

Micronaut data : No backing RepositoryOperations configured for repository


I am getting this following exception when I try configuring micronaut-data with inmemory h2 database and Jpa.
I have been following the documentation

I created the project from command line with maven as build tool. I have the following

<dependency>
     <groupId>io.micronaut.configuration</groupId>
      <artifactId>micronaut-jdbc-tomcat</artifactId>
      <scope>runtime</scope>
    </dependency>
<dependency>
     <groupId>com.h2database</groupId>
     <artifactId>h2</artifactId>
     <scope>runtime</scope>
</dependency>
<dependency>
     <groupId>io.micronaut.data</groupId>
     <artifactId>micronaut-data-hibernate-jpa</artifactId>
     <version>1.0.0.M3</version>
</dependency>

And Also I have added annotation processor like this

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
   ......
  <configuration>
    ...
    <annotationProcessorPaths>
      <path>
        <groupId>io.micronaut</groupId>
        <artifactId>micronaut-inject-java</artifactId>
        <version>${micronaut.version}</version>
      </path>
      <path>
        <groupId>io.micronaut</groupId>
        <artifactId>micronaut-validation</artifactId>
        <version>${micronaut.version}</version>
      </path>
      <path>
        <groupId>io.micronaut.data</groupId>
        <artifactId>micronaut-data-processor</artifactId>   
        <version>1.0.0.M3</version>
      </path>
    </annotationProcessorPaths>
  </configuration>
  .....
</plugin>

My Entity class and Repository class are exactly as mentioned in the guide. When I try to save using the repository, I get this exception

18:16:37.787 [pool-1-thread-3] ERROR i.m.h.s.netty.RoutingInBoundHandler - Unexpected error occurred: No backing RepositoryOperations configured for repository. Check your configuration and try again
io.micronaut.context.exceptions.ConfigurationException: No backing RepositoryOperations configured for repository. Check your configuration and try again
..............................
Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.data.operations.RepositoryOperations] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).

I have already looked into this. This is completely different and it doesn't help my issue.

Interestingly if I change the order of micronaut data annotation processsor I mean If I put like this

<plugin>                                                    
  <groupId>org.apache.maven.plugins</groupId>               
  <artifactId>maven-compiler-plugin</artifactId>            
   ......                                                   
  <configuration>                                           
    ...                                                     
    <annotationProcessorPaths>                              
      <path>                                                
        <groupId>io.micronaut</groupId>                     
        <artifactId>micronaut-inject-java</artifactId>      
        <version>${micronaut.version}</version>             
      </path>                                               
      <path>                                                
        <groupId>io.micronaut</groupId>                     
        <artifactId>micronaut-validation</artifactId>       
        <version>${micronaut.version}</version>             
      </path>                                               
      <path>                                                
        <groupId>io.micronaut.data</groupId>                
        <artifactId>micronaut-data-processor</artifactId>   
        <version>1.0.0.M3</version>                         
      </path>                                               
    </annotationProcessorPaths>                             
  </configuration>                                          
  .....                                                     
</plugin>  

I get a different exception.

Internal Server Error: All possible Introduction advise exhausted and no implementation found for method: Iterable saveAll(Iterable entities) 

Any pointers are much appreciated.


Solution

  • The documentation was incomplete. Did a pull request (https://github.com/micronaut-projects/micronaut-data/pull/197) with the documentation update. It has been accepted. The updated documentation can be found here

    Need another dependency for this to work

    <dependency>
        <groupId>io.micronaut.data</groupId>
        <artifactId>micronaut-data-hibernate-jpa</artifactId>
    </dependency>