Skip to content

This repository demonstrates how 2 implement Liquibase R2DBC Spring Boot starter. Stack: Liquibase R2DBC Spring Boot starter with next technology stack: Liquibase, R2DBC, Spring Boot, Kotlin, Junit Jupiter 5, MySQL, MariaDB, PostgreSQL, MS SQL Server, H2, r2dbc-pool, r2dbc-proxy, Test-containers, Maven, Bash

License

Notifications You must be signed in to change notification settings

daggerok/liquibase-r2dbc-spring-boot-starter

Repository files navigation

Liquibase R2DBC spring-boot starter tests pages

This repository demonstrates how 2 implement Liquibase R2DBC Spring Boot starter to be used in reactive projects with MySQL, MariaDB, PostgreSQL, MS SQL Server, r2dbc-pool, r2dbc-proxy or H2 database. It's not pure reactive liquibase implementation as you might think, we are simply transforming R2DBC URL into liquibase compatible in a little spring-boot starter to apply liquibase migrations update automatically within application runner bean

Support

Java 17, 18, 19, 20 with Spring Boot 3.x

Maven Central

Getting started

<dependency>
  <groupId>io.github.daggerok</groupId>
  <artifactId>liquibase-r2dbc-spring-boot-starter</artifactId>
  <version>3.1.3</version>
</dependency>

or

dependency("io.github.daggerok:liquibase-r2dbc-spring-boot-starter:3.1.3")

And then use regular Spring Boot + Liquibase setup:

  • Create necessary Liquibase migration src/main/resources/liquibase/master-changelog.xml file
  • In application.yaml file add necessary liquibase configuration:
    spring:
      r2dbc:
        url: 'r2dbc:mysql://127.0.0.1:3306/database'
        username: 'user'
        password: 'password'
      liquibase:
        change-log: classpath*:/liquibase/changelog-master.xml
    logging:
      level:
        io.netty.resolver.dns.DnsServerAddressStreamProviders: off
  • In pom.xml add necessary dependencies related to database going to be used:
    • MySQL:
      <dependencies>
          <dependency>
              <groupId>com.mysql</groupId>
              <artifactId>mysql-connector-j</artifactId>
              <scope>runtime</scope>
          </dependency>
          <dependency>
              <groupId>dev.miku</groupId>
              <artifactId>r2dbc-mysql</artifactId>
              <version>0.8.2.RELEASE</version>
              <scope>runtime</scope>
          </dependency>
      <dependencies>
    • MariaDB:
      <dependencies>
          <dependency>
              <groupId>org.mariadb.jdbc</groupId>
              <artifactId>mariadb-java-client</artifactId>
              <scope>runtime</scope>
          </dependency>
          <dependency>
              <groupId>org.mariadb</groupId>
              <artifactId>r2dbc-mariadb</artifactId>
              <scope>runtime</scope>
          </dependency>
          <dependency>
              <groupId>io.r2dbc</groupId>
              <artifactId>r2dbc-pool</artifactId>
              <scope>runtime</scope>
          </dependency>
      <dependencies>
    • PostgreSQL:
      <dependencies>
          <dependency>
              <groupId>org.postgresql</groupId>
              <artifactId>postgresql</artifactId>
              <scope>runtime</scope>
          </dependency>
          <dependency>
              <groupId>org.postgresql</groupId>
              <artifactId>r2dbc-postgresql</artifactId>
              <scope>runtime</scope>
          </dependency>
      <dependencies>
    • H2:
      <dependencies>
          <dependency>
              <groupId>com.h2database</groupId>
              <artifactId>h2</artifactId>
              <scope>runtime</scope>
          </dependency>
          <dependency>
              <groupId>io.r2dbc</groupId>
              <artifactId>r2dbc-h2</artifactId>
              <scope>runtime</scope>
          </dependency>
      <dependencies>

NOTE: If you want to use *-SNAPSHOT version, please make sure you have added snapshot maven repository like so

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype OSS Snapshot Repository</name>
        <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        <snapshots><enabled>true</enabled></snapshots>
        <releases><enabled>false</enabled></releases>
    </repository>
</repositories>

or

repositories {
    maven {
        url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
    }
}

See: https://s01.oss.sonatype.org/content/repositories/snapshots/io/github/daggerok/

Otherwise, use only released version. See: https://repo1.maven.org/maven2/io/github/daggerok/liquibase-r2dbc-spring-boot-starter/

Technology Stack

  • Liquibase
  • R2DBC
  • Spring Boot 3.x
  • Kotlin
  • Junit Jupiter 5
  • H2 (file, mem)
  • MySQL
  • MariaDB
  • Postgresql
  • MS SQL Server
  • R2DBC (pool, proxy)
  • Testcontainers
  • Maven

Reference documentation

About

This repository demonstrates how 2 implement Liquibase R2DBC Spring Boot starter. Stack: Liquibase R2DBC Spring Boot starter with next technology stack: Liquibase, R2DBC, Spring Boot, Kotlin, Junit Jupiter 5, MySQL, MariaDB, PostgreSQL, MS SQL Server, H2, r2dbc-pool, r2dbc-proxy, Test-containers, Maven, Bash

Topics

Resources

License

Stars

Watchers

Forks