【无标题】

第一次使用r2dbc,在一个四年的工程里。因为工程的dependencyManagement限制了依赖的版本:

复制代码
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-r2dbc</artifactId>
        </dependency>
        一开始用的下面这个:
        <dependency>
            <groupId>io.asyncer</groupId>
            <artifactId>r2dbc-mysql</artifactId>
            <version>1.4.0</version>
        </dependency>
        后来换成下面这个:
        <dependency>
            <groupId>dev.miku</groupId>
            <artifactId>r2dbc-mysql</artifactId>
            <version>0.8.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

spring-boot-starter-data-r2dbc版本是2.3.9,

mysql-connector-java版本是8.0.27

r2dbc-mysql的版本是1.4.0

启动的时候报错误:
java.lang.NoSuchFieldError: LOCK_WAIT_TIMEOUT

搜到了一个github的oracle-r2dbc类库ISSUE页面,有人回答是版本不兼容导致的。spring-boot-starter-data-r2dbc如果是版本低,那么应该用r2dbc类库的0.8版本。mvnrepository中没有看到这个类库有0.9以下版本。直到看到这个贴子:

https://github.com/asyncer-io/r2dbc-mysql

Refer to the table below to determine the appropriate version of r2dbc-mysql for your project.

推荐的版本如下:

spring-boot-starter-data-r2dbc spring-data-r2dbc r2dbc-spi r2dbc-mysql(recommended)
3.0.* and above 3.0.* and above 1.0.0.RELEASE io.asyncer:r2dbc-mysql:1.4.0
2.7.* 1.5.* 0.9.1.RELEASE io.asyncer:r2dbc-mysql:0.9.7
2.6.* and below 1.4.* and below 0.8.6.RELEASE dev.miku:r2dbc-mysql:0.8.2
相关推荐
爱睡觉的王宇昊3 小时前
单体架构详细解析:从概念到实践--购物网站搭建
java·spring boot·架构·团队开发·个人开发·敏捷流程
記億揺晃着的那天4 小时前
Amazon SP-API,授权封装、SDK 分层与 AAD 加密一致性设计
spring boot·架构设计·amazon sp-api·sdk 设计
大学生资源网6 小时前
基于springboot的万亩助农网站的设计与实现源代码(源码+文档)
java·spring boot·后端·mysql·毕业设计·源码
q_19132846956 小时前
基于SpringBoot2+Vue2的诗词文化传播平台
vue.js·spring boot·mysql·程序员·计算机毕业设计
五阿哥永琪7 小时前
RedisTemplate、StringRedisTemplate、RedisIndexedSessionRepository之间的区别?
spring boot
计算机毕设指导68 小时前
基于微信小程序的鸟博士系统【源码文末联系】
java·spring boot·mysql·微信小程序·小程序·tomcat·maven
QQ_21696290968 小时前
Spring Boot大学生社团管理平台 【部署教程+可完整运行源码+数据库】
java·数据库·spring boot·微信小程序
是席木木啊9 小时前
Spring Boot 中 @Async 与 @Transactional 结合使用全解析:避坑指南
数据库·spring boot·oracle
阿拉斯攀登9 小时前
自定义 Spring Boot 自动配置
java·spring boot