'Spring boot r2dbc and jdbc Liquibase does not update on application start
I want my application to use r2dbc drive when running and jdbc to handle the database with Liquibase. I have this 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
Solution 1:[1]
You have two options to use db migrations like Liquibase in a R2bc application.
Till now Liquibase did not support R2dbc, and by default R2dbc and Jdbc can not be activated in a single Spring boot application. In a reactive Spring Boot application, although you added a Jdbc starter, it is not activated by default.
But you can setup liquibase in a R2dbc application, and configure Liquibase Maven/Gradle plugin to migrate the database manually by Gradle tasks/Maven goals. See my example: liquibase-maven-r2dbc, make sure the db is running, and execute
mvn liquibase:update
in the project root.See the official guide of Liquibase Maven PLugin, https://docs.liquibase.com/tools-integrations/maven/workflows/using-liquibase-maven-plugin-and-springboot.html
Use R2dbc Migrate directly, it is similar to Flyway but working with 2rdbc. See my example: r2dbc-migrate.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hantsy |