Liquibase R2DBC Spring Boot starter

Last update: Jun 18, 2022

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

Maven Central

Getting started

<dependency>
  <groupId>io.github.daggerokgroupId>
  <artifactId>liquibase-r2dbc-spring-boot-starterartifactId>
  <version>2.0.5version>
dependency>

or

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

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

<repositories>
    <repository>
        <id>sonatype-nexus-snapshotsid>
        <name>Sonatype OSS Snapshot Repositoryname>
        <url>https://s01.oss.sonatype.org/content/repositories/snapshotsurl>
        <snapshots><enabled>trueenabled>snapshots>
        <releases><enabled>falseenabled>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
  • Kotlin
  • Junit Jupiter 5
  • H2 (file, mem)
  • MySQL
  • MariaDB
  • Postgresql
  • MS SQL Server
  • R2DBC (pool, proxy)
  • Testcontainers
  • Maven

Reference documentation

Checkout documentation for details

Developer guide for contributors

Feel free to contribute! Create a fork or report bug to improve this project

Build and test

./mvnw clean ; ./mvnw verify

Integration test (MySQL)

if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi

docker run -d --rm --name mysql --platform=linux/x86_64 \
  --health-cmd='mysqladmin ping -h 127.0.0.1 -u $MYSQL_USER --password=$MYSQL_PASSWORD || exit 1' \
  --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
  -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=database \
  -e MYSQL_USER=user -e MYSQL_PASSWORD=password \
  -p 3306:3306 \
  mysql:8.0.24

while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do
  sleep 3 ; echo -n '.'
done

sleep 15; echo 'MySQL is ready.'

rm -rf ~/.m2/repository/daggerok/liquibase/r2dbc* 
./mvnw clean install -DskipTests

./mvnw -f examples/mysql spring-boot:start

http :8001
http :8001/api
http :8001/api/messages
http :8001/api/messages body=hey
http :8001/api/messages

./mvnw -f examples/mysql spring-boot:stop
docker stop mysql

Integration test (Postgresql)

if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi

docker run -d --rm --name postgres -p 5432:5432 --platform=linux/x86_64 \
  -e POSTGRES_PASSWORD=password -e POSTGRES_DB=database -e POSTGRES_USER=user \
  --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
  --health-cmd='pg_isready -h 127.0.0.1 -p 5432 -d $POSTGRES_DB -U $POSTGRES_USER || exit 1' \
  postgres:14.3-alpine3.16

while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do
  sleep 3 ; echo -n '.'
done

rm -rf ~/.m2/repository/daggerok/liquibase/r2dbc* 
./mvnw clean install -DskipTests

./mvnw -f examples/postgresql spring-boot:start

http :8002
http :8002/api
http :8002/api/messages
http :8002/api/messages body=hey
http :8002/api/messages

./mvnw -f examples/postgresql spring-boot:stop
docker stop postgres

Integration test (H2 file)

rm -rf ~/.m2/repository/daggerok/liquibase/r2dbc* 
./mvnw clean install -DskipTests

./mvnw -f examples/h2/file spring-boot:start

http :8003
http :8003/api
http :8003/api/messages
http :8003/api/messages body=hey
http :8003/api/messages

./mvnw -f examples/h2/file spring-boot:stop

Integration test (H2 mem)

rm -rf ~/.m2/repository/daggerok/liquibase/r2dbc* 
./mvnw clean install -DskipTests

./mvnw -f examples/h2/mem spring-boot:start

http :8004
http :8004/api
http :8004/api/messages
http :8004/api/messages body=hey
http :8004/api/messages

./mvnw -f examples/h2/mem spring-boot:stop

Integration test (H2 tcp file)

if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi

docker run -p 3306:3306 -d --rm --name mariadb --platform=linux/x86_64 \
  --env MARIADB_USER=user --env MARIADB_PASSWORD=password --env MARIADB_ROOT_PASSWORD=password --env MARIADB_DATABASE=database \
  --health-cmd='mysqladmin ping -h 127.0.0.1 -u $MARIADB_USER --password=$MARIADB_PASSWORD || exit 1' \
  --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
  mariadb:10.7.4

while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do
  sleep 3 ; echo -n '.'
done
echo 'MariaDB is ready.'

rm -rf ~/.m2/repository/daggerok/liquibase/r2dbc* 
./mvnw clean install -DskipTests

./mvnw -f examples/mariadb spring-boot:start

http :8005
http :8005/api
http :8005/api/messages
http :8005/api/messages body=hey
http :8005/api/messages

./mvnw -f examples/mariadb spring-boot:stop

Integration test (MariaDB)

if [[ "" != `docker ps -aq` ]] ; then docker rm -f -v `docker ps -aq` ; fi

docker run -p 3306:3306 -d --rm --name mariadb --platform=linux/x86_64 \
  --env MARIADB_USER=user --env MARIADB_PASSWORD=password --env MARIADB_ROOT_PASSWORD=password --env MARIADB_DATABASE=database \
  --health-cmd='mysqladmin ping -h 127.0.0.1 -u $MARIADB_USER --password=$MARIADB_PASSWORD || exit 1' \
  --health-start-period=1s --health-retries=1111 --health-interval=1s --health-timeout=5s \
  mariadb:10.7.4

while [[ $(docker ps -n 1 -q -f health=healthy -f status=running | wc -l) -lt 1 ]] ; do
  sleep 3 ; echo -n '.'
done
echo 'MariaDB is ready.'

rm -rf ~/.m2/repository/daggerok/liquibase/r2dbc* 
./mvnw clean install -DskipTests

./mvnw -f examples/mariadb spring-boot:start

http :8005
http :8005/api
http :8005/api/messages
http :8005/api/messages body=hey
http :8005/api/messages

./mvnw -f examples/mariadb spring-boot:stop

GitHub

https://github.com/daggerok/liquibase-r2dbc-spring-boot-starter
You might also like...

This repository demonstrates how Kotlin can simplify Spring Boot configuration properties file mapping

Kotlin spring-boot nested config props This repository demonstrates how Kotlin can simplify Spring Boot configuration properties file mapping @Constru

Oct 11, 2021

My personal template for a Spring Boot REST reactive webapp

My personal spring boot kotlin reactive template Features Spring Security implementation with JWT access and refresh token MongoDB database Project Co

Dec 1, 2021

The Okila server project uses the Spring boot framework and uses the Kotlin language

Okila-Server The Okila server project uses the Spring boot framework and uses the Kotlin language Format Response //The response successfully format

Oct 25, 2021

An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL

graphql-kotlin-spring-server An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL Running the s

Oct 31, 2021

API for a library using Kotlin, Spring-boot and covered by test

Library API This API is to create Books and be able to borrow from them I'm using: Spring Boot version 2.5.6 Kotlin 1.5.31 Java 11 I'm implementing us

Nov 5, 2021

Push notification application using One Signal + Spring Boot + Kotlin

Spring Boot push notification system using One Signal This project was created to demonstrate a simple application built with Kotlin + Spring Boot inc

Nov 1, 2021

Kotlin Based Spring Boot ETL project

Kotlin Based Spring Boot ETL project

Adverity ETL REST API (AERA) A simple ETL Spring Boot application with H2. This API provides the following basics functionalities: Endpoint that retur

Oct 11, 2021

Spring Boot Webflux RDBMS Sample App

R2DBC Spring Boot Webflux Sample Project generate schema (DDL script) h2-console (Web based database management console) WebFlux and r2dbc is not supp

Nov 7, 2021

Solution for task 5 on Spring Boot https://t.me/try2py/197

IouRestService (Spring Boot Application) Решение задачи 5 https://t.me/try2py/197 Условие задачи: Четверо соседей по комнате имеют привычку занимать д

Nov 22, 2021
Comments
  • 1. why do u use R2DBC

    Hi, i am reading your project and i am interested in this, but i have a question, why do you use R2DBC instead of other non blocking IO like Hibernate Reactive or others... can you tell me your purpose, the pros and cons of R2DBC, thank you so much

    Reviewed by fizz12344321 at 2022-06-21 01:27
Demo Spting REST Service on Kotlin. Works with PostgreSQL via Spring Data. Data initialization provided by liquibase

Spring Boot REST API with Kotlin Spring Boot REST API service. Spring Data with PostgreSQL. Data initialization with Liquibase. Swagger UI Reference D

Jun 10, 2022
This repository demonstrates Spring GraphQL + RSocket + WebFlux + R2DBC + H2

Reactive GraphQL with Spring This repository demonstrates Spring GraphQL + RSocket + WebFlux + R2DBC + H2 O__ +-----------+

Nov 27, 2021
Generated with spring boot kotlin starter kit

Kotlin backend Generated with spring boot kotlin starter kit The idea is to: Get a microservice written in kotlin for managing users and roles. To be

Oct 19, 2021
This repository contains RabbitMQ Protobuf starters with its usage samples for spring-rabbit and spring-cloud-starter-stream-rabbit modules

This repository contains RabbitMQ Protobuf starters with its usage samples for spring-rabbit and spring-cloud-starter-stream-rabbit modules

Nov 29, 2021
Spring-with-maven - Spring Boot App with Postgresql and maven

Spring Boot Api Aplikasi ini dibuat menggunakan bahasa kotlin dan untuk database

Jan 12, 2022
Spring-graphql-getting-started - Spring for GraphQL provides support for Spring applications built on GraphQL Java

Getting Started with GraphQL and Spring Boot Spring for GraphQL provides support

Feb 2, 2022
R2DBC Sharding Example with Kotlin Coroutine

R2DBC Sharding Example with Kotlin Coroutine A minimal sharding example with R2DBC and coroutine, where user table is divided into 2 different shards.

Oct 4, 2021
Spring Boot Example with Kotlin and Domain Driven Design

Spring Boot Kotlin Domain Driven Design Example Just an example project where ddd is implemented with some other great patterns and architecture from

Jun 15, 2022
A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

spring-kotlin-gql-gae This is a sample skeleton of a backend app that was built using: Spring Boot(Kotlin) Reactive Web Sprinng Data R2DBC with MYSQL

Oct 3, 2021
Sample Social Login Project of Spring Boot and Kotlin

Sample-Spring-Boot-Social-Kotlin Sample Social Login Project of Spring Boot and Kotlin dependencies dependencies { implementation("org.springframewor

Oct 11, 2021