Spring 启动 r2dbc 和 jdbc Liquibase 不在应用程序启动时更新

Spring boot r2dbc and jdbc Liquibase does not update on application start

我希望我的应用程序在 运行 和 jdbc 使用 Liquibase 处理数据库时使用 r2dbc 驱动器。我有 as a reference. It is possible by adding the correct configuration inside application.properties and build.gradle.kts to achieve that. Update and everything is working but not automatically. Do you have any suggestions?Spring's reference

您有两种选择可以在 R2bc 应用程序中使用 Liquibase 等数据库迁移。

  1. 目前Liquibase不支持R2dbc,默认 R2dbc和Jdbc不能同时激活Spring引导应用程序。在反应式 Spring 引导应用程序中,虽然您添加了一个 Jdbc 启动器,但默认情况下它不会被激活。

    但您可以在 R2dbc 应用程序中设置 liquibase,并配置 Liquibase Maven/Gradle 插件以通过 Gradle tasks/Maven 手动 迁移数据库 目标。看我的例子:liquibase-maven-r2dbc,确保db是运行,然后在项目根目录下执行mvn liquibase:update

    查看Liquibase Maven PLugin官方指南,https://docs.liquibase.com/tools-integrations/maven/workflows/using-liquibase-maven-plugin-and-springboot.html

  2. 使用R2dbc Migrate directly, it is similar to Flyway but working with 2rdbc. See my example: r2dbc-migrate