You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot 3.2.4升级后entityManagerFactory Bean创建报错求助

问题解决:Spring Boot 3.2.4 升级后 Hypersistence Utils 启动报错

核心原因

Spring Boot 3.2.4 绑定的 Hibernate 版本为 6.3.x,你最初使用的 hypersistence-utils-hibernate-62:3.5.3 是适配 Hibernate 6.2.x 的版本,二者的类结构(如 EnumValueConverter)存在兼容性差异。即使更换为 hibernate-63 版本,若依赖未清理干净或版本不匹配,仍会出现类找不到的问题。

解决方案

  • 使用适配 Hibernate 6.3 的正确版本:确保引入的 Hypersistence Utils 版本完全兼容 Spring Boot 3.2.x 绑定的 Hibernate。推荐使用 3.6.0 及以上版本的 hypersistence-utils-hibernate-63,该版本专门适配 Hibernate 6.3。
    Maven 依赖示例:
    <dependency>
        <groupId>io.hypersistence</groupId>
        <artifactId>hypersistence-utils-hibernate-63</artifactId>
        <version>3.6.0</version>
    </dependency>
    
    Gradle 依赖示例:
    implementation 'io.hypersistence:hypersistence-utils-hibernate-63:3.6.0'
    
  • 清理依赖冲突:
    1. 用依赖分析工具检查项目依赖树:
      • Maven:执行 mvn dependency:tree
      • Gradle:执行 ./gradlew dependencies
        确认没有残留的 hypersistence-utils-hibernate-62 或低版本 Hibernate 依赖。
    2. 若存在冲突,显式排除旧版依赖(以 Maven 为例):
      <dependency>
          <groupId>io.hypersistence</groupId>
          <artifactId>hypersistence-utils-hibernate-63</artifactId>
          <version>3.6.0</version>
          <exclusions>
              <exclusion>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-core</artifactId>
              </exclusion>
          </exclusions>
      </dependency>
      
  • 清理本地缓存并重新构建:
    • Maven:执行 mvn clean install -U
    • Gradle:执行 ./gradlew clean build --refresh-dependencies
      确保本地仓库中没有缓存的旧版依赖文件。

内容的提问来源于stack exchange,提问作者woHaha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 21:52:08