Micronaut 数据:没有为存储库配置支持 RepositoryOperations [英] Micronaut data : No backing RepositoryOperations configured for repository

查看:65
本文介绍了Micronaut 数据:没有为存储库配置支持 RepositoryOperations的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用内存中的 h2 数据库和 Jpa 配置 micronaut-data 时,出现以下异常.
我一直在关注文档

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

我使用 maven 作为构建工具从命令行创建了该项目.我有以下

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.

有趣的是,如果我改变 micronaut 数据注释过程的顺序,或者我的意思是如果我这样放

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) 

非常感谢任何指针.

推荐答案

文档不完整.做了一个拉取请求(https://github.com/micronaut-projects/micronaut-data/pull/197) 与文档更新.它已被接受.可以在此处

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>

这篇关于Micronaut 数据:没有为存储库配置支持 RepositoryOperations的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆