【无标题】

第一次使用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
相关推荐
终将老去的穷苦程序员1 天前
基于SpringBoot的餐饮管理系统
java·spring boot·后端
心之伊始1 天前
Spring AI Tool Calling 实战:让 Java Agent 调用本地 Bean 工具方法
java·spring boot·agent·spring ai·tool calling
熠熠仔1 天前
Spring Boot 与 MyBatis-Plus 空间几何数据集成指南
spring boot·后端·mybatis
天青色等烟雨..1 天前
智慧农林核心遥感技术99个案例实践
运维·人工智能·spring boot·后端·自动化
雪宫街道1 天前
SpringBoot 向 IOC 容器注册组件的两种姿势:@Configuration 与 @Import
java·spring boot·后端·spring
接着奏乐接着舞1 天前
springboot mp mybatis plaus
windows·spring boot·mybatis
金融支付架构实战指南1 天前
Milvus 向量检索服务 + SpringBoot 实战:电商商品语义检索与相似商品推荐
spring boot·后端·milvus·向量检索
愛~杦辷个訾1 天前
Java Springboot使用阿里云oss对图片进行等质量压缩,转换成webp格式的压缩图。
java·spring boot·阿里云·oss
霸道流氓气质1 天前
Spring Boot Multipart 表单中文乱码问题全解析
java·spring boot·后端
RuoyiOffice1 天前
从 0 到 1 搭建 RuoyiOffice:30 分钟跑通后端+前端+移动端
前端·spring boot·uni-app·开源·oa·ruoyioffice·hrm