Spring boot 使用r2dbc配置进行液化初始化

Spring boot 使用r2dbc配置进行液化初始化,spring-boot,liquibase,r2dbc,Spring Boot,Liquibase,R2dbc,正在尝试使用r2dbc和init数据库运行spring引导。 我的build.gradle看起来像: dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc' implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.liquibase

正在尝试使用r2dbc和init数据库运行spring引导。 我的build.gradle看起来像:

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
    implementation 'org.springframework.boot:spring-boot-starter-webflux'
    implementation 'org.liquibase:liquibase-core'

    compileOnly 'org.projectlombok:lombok'

    runtimeOnly 'org.liquibase:liquibase-core'
    runtimeOnly 'com.h2database:h2'
    runtimeOnly 'io.r2dbc:r2dbc-h2'
    runtimeOnly 'io.r2dbc:r2dbc-postgresql'
    runtimeOnly 'org.postgresql:postgresql'

    annotationProcessor 'org.projectlombok:lombok'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'io.projectreactor:reactor-test'
}
弹簧特性:

spring.r2dbc.url=r2dbc:postgresql://127.0.0.1:5432/test
spring.r2dbc.username=postgres
spring.r2dbc.password=123
spring.r2dbc.pool.enabled=true
spring.r2dbc.pool.initial-size=10
spring.data.r2dbc.repositories.enabled=true

spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
spring.liquibase.url=jdbc:postgresql://127.0.0.1:5432/test
spring.liquibase.user=postgres
spring.datasource.driver-class-name=org.postgresql.Driver
logging.level.liquibase = INFO
开始后,它会随着

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [liquibase.integration.spring.SpringLiquibase]: Factory method 'liquibase' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/SimpleDriverDataSource

有什么不对吗?

您需要在
org.springframework:springjdbc
上添加依赖项。从:

或者,您可以配置Flyway或Liquibase,以便在迁移期间为您配置数据源。这两个库都提供属性来设置要迁移的数据库的url、用户名和密码

选择此选项时,
org.springframework:springjdbc
仍然是必需的依赖项


upd。如果我添加org.springframework.boot:springbootstarter数据jpa依赖项,它将开始下降,并出现NoBeanAvailable异常:无法实例化存储库。