Micronaut 数据:没有为存储库配置支持 RepositoryOperations

2024-05-02

当我尝试使用内存 h2 数据库和 Jpa 配置 micronaut-data 时,出现以下异常。
我一直在关注文档 https://micronaut-projects.github.io/micronaut-data/latest/guide/#buildConfig

我使用 Maven 作为构建工具从命令行创建了该项目。我有以下内容

<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>

而且我还添加了这样的注释处理器

<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>

我的实体类和存储库类与指南中提到的完全相同。当我尝试使用存储库保存时,出现此异常

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).

我已经调查过this https://stackoverflow.com/questions/57848864/getting-error-while-connecting-to-jpa-using-micronaut-data-hibernate-jpa-library。这是完全不同的,它对我的​​问题没有帮助。

有趣的是,如果我改变 micronaut 数据注释处理器的顺序,或者我的意思是如果我这样写

<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>  

我得到了一个不同的例外。

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

非常感谢任何指点。


我收到此错误,我的案例的解决方案是将以下内容添加到application.yml:

jpa:
  default:
    properties:
      hibernate:
        bytecode:
          provider: none

这是基于此处的示例项目:https://github.com/micronaut-projects/micronaut-data/blob/v1.0.0.M3/examples/example-jpa/src/main/resources/application.yml#L15 https://github.com/micronaut-projects/micronaut-data/blob/v1.0.0.M3/examples/example-jpa/src/main/resources/application.yml#L15

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Micronaut 数据:没有为存储库配置支持 RepositoryOperations 的相关文章

随机推荐

  • 如何转换温度传感器得到的值?

    我在ST工作Temperature sensor hts221 我用I2C与传感器的命令通信 我从文档中看到类似以下文字 enter code here Temperature data are expressed as TEMP OUT
  • WPF 向我的 GUI 添加时钟

    简单请求 我希望能够在 WPF 应用程序窗口中显示当前时间 有免费的控件吗 只需要显示时间 没有别的 您可以有一个标签或文本块 并将其内容绑定到 System DateTime Now
  • Hibernate 验证器:违规消息语言

    我有一个测试类 我正在测试一个域模型 该模型用例如注释 NotNull 在我的测试课中 我首先得到验证器 private static Validator validator BeforeClass public static void s
  • Ember.js 动态子视图

    我无法让 ember 渲染动态子视图 似乎一旦渲染了子视图 绑定就会丢失 这是一个jsfiddle http jsfiddle net zaius XYzfa http jsfiddle net zaius XYzfa 当您在两个编辑器页面
  • CSS:悬停在多个 div 上时显示样式

    我有 2 个不同尺寸的 div 一个放在另一个上面 所以有一个共同的交叉区域 这两个 div 都有 CSS hover 规则集 如果我将鼠标悬停在每个 div 上 则规则适用 但是 如果我移过交叉区域 则只会激活顶部 div 悬停 当鼠标悬
  • 如何找到给定数组的所有可能的子集?

    我想在 C 或 C 中提取数组的所有可能子集 然后计算所有子集数组各自元素的总和 以检查其中有多少等于给定数字 我正在寻找的是算法 我确实理解这里的逻辑 但我现在还无法实现这一逻辑 考虑一组S of N元素 以及给定的子集 每个元素要么属于
  • 使用 pymongo 查询空字段

    我想使用 python 查询 mongo 中的空字段 但是它很难处理单词 null 或 false 它要么给我错误 它们在 python 中未定义 要么在 mongo 中搜索字符串 null 和 false 这两种情况我都不希望发生 col
  • Cloudflare Worker 缓存 API 出现问题

    我现在花了无数的时间尝试让缓存 API 来缓存一个简单的请求 我让它在中间工作过一次 但忘记向缓存键添加一些内容 现在它不再工作了 不用说 cache put 没有指定请求是否实际被缓存的返回值并不完全有帮助 我只能进行反复试验 有人可以给
  • 如何解决警告“没有明确的所有权”

    我有一种方法 它采用间接指针作为参数 然后 如果出现错误 将其设置为错误对象 我正在尝试打开尽可能多的警告 但其中之一 Implicit ownership types on out parameters 在此方法中生成警告 id doWi
  • asp.net 3.5 是否支持单个页面上的多个表单?

    我只是想确认这是否属实 我记得在某处读到现在这是可能的 但经过一个小时的谷歌搜索后我找不到任何明确的证据 在 ASP NET WebForms 中 您不能使用多个表单 因为它使用单个表单模型 在 ASP NET MVC 中您可以
  • 如何将2个匹配查询加入到elasticsearch的查询中?

    我想查询以下数据user id is 1 and name is John 写一个常用的SQL很容易 select from t where user id 1 and name John 但对我来说进行elasticsearch的查询并不
  • 从 Azure 流分析将数据插入 Azure SQL 数据库表时出现“OutputDataConversionError.TypeConversionError”

    我正在尝试学习 Azure IoT 我正在尝试将 MQTT 消息发送到 IoT 中心 在 IoT 中心 我使用流分析将数据输出到 SQL 数据库中 但目前在流分析输出中 我遇到此错误 9 12 30 AM 源 OUTPUTSQL 在处理时间
  • 如何设置按钮的大小?

    我将按钮放在带有 GridLayout 的 JPane 中 然后我用 BoxLayout Y AXIS 将 JPanel 放入另一个 JPanel 中 我希望 GridLayout 中的按钮是方形的 我使用 tmp setSize 30 3
  • 将列表视图项转换为单个位图图像

    参考这个主题 Android 获取所有 ListView 项目的屏幕截图 https stackoverflow com questions 12742343 android get screenshot of all listview i
  • WCF 复杂 JSON 输入错误(无法通过 QueryStringConverter 转换)

    我在将复杂 JSON 作为 WCF 服务中的参数工作时遇到问题 在 Visual Studio 2008 SP1 中使用 Microsoft Net 3 5 SP1 签订以下合同 ServiceContract public interfa
  • 带有 numberOfLines 和 lineBreakMode 的 UILabel

    我正在开发一个必须同时支持 iOS6 和 iOS7 的项目 我的问题是它在不同的系统上工作不同 我试图创建行数等于 2 的 UILabel 但是当我将其换行模式设置为 NSLineBreakByTruncatingTail 时 它的工作方式
  • 实时跟踪每分钟/小时/天的前 100 个 Twitter 单词

    我最近遇到这样一个面试问题 Given a continuous twitter feed design an algorithm to return the 100 most frequent words used at this min
  • 并排镜像两个打开的缓冲区中的文件位置

    我试图在 emacs 中找到一个包 函数 它可以并排打开两个文件 使其位于同一行位置 镜像正在移动的缓冲区的移动 这意味着 对于并排打开的两个缓冲区 在其中一个缓冲区中移动 向上 向下翻页 移动光标等 将在另一个缓冲区中进行相同的移动 更具
  • 如何在data.table中编写累积计算

    顺序累积计算 我需要进行时间序列计算 其中每行计算的值取决于上一行计算的结果 我希望能够利用data table 实际问题是水文模型 累积水平衡计算 在每个时间步长增加降雨量 并减去径流和蒸发作为当前水量的函数 该数据集包括不同的流域和场景
  • Micronaut 数据:没有为存储库配置支持 RepositoryOperations

    当我尝试使用内存 h2 数据库和 Jpa 配置 micronaut data 时 出现以下异常 我一直在关注文档 https micronaut projects github io micronaut data latest guide