Spring R2dbc Example
This repository contains the latest changes in the Spring R2dbc(part of Spring Framework 5.3), Spring Data R2dbc 1.2 and Spring Boot 2.4.
I have created several R2dbc examples in the spring-reactive-sample repository since it was born. But Spring Data R2dbc evolved very quickly, thre are plenty of breaking changes introduced since Spring 5.2 and Spring Data R2dbc 1.2.
Compare to the Spring Data R2dbc 1.1, some breaking changes are notable.
- The old DatabaseClient in Spring Data R2dbc 1.1 was split into two parts, a simple new
DatabaseClient
is part of Spring framework, as an alternative of Jdbc. - Another part of the old DatabaseClient is reorganized into a new class
R2dbcEntityTemplate
which acts as the role ofJdbcTemplate
.
Notes
- Introduction to R2dbc
- Working with Relational Database using R2dbc DatabaseClient
- Update: Accessing RDBMS with Spring Data R2dbc
- Data Auditing with Spring Data R2dbc
- Dealing with Postgres specific Json/Enum type and NOTIFY/LISTEN with R2dbc
- Building Chat Application with R2dbc and Postgres
Sample Codes
Example | Description |
---|---|
connection-factories | R2dbc driver's ConnectionFactory examples for MySQL, H2, PostgreSQL, MSSQL, Oracle, etc |
database-client | Spring R2dbc DatabaseClient example |
data-r2dbc-entitytemplates | Spring Data R2dbc R2dbcEntityTemplate example |
data-r2dbc-repositories | Spring Data R2dbc R2dbcRepository interface example |
entitycallbacks | Spring Data R2dbc BeforeConvertEntityCallback , AfterConvertEntityCallback , etc. |
testcontainers | Spring Data R2dbc @DataR2dbcTest with Testcontainers. |
boot | Spring Boot example (with Postgres specific Enum , Json , NOTIFY/LISTEN , etc.) |
boot-filepart | Spring Boot FilePart example, Postgres bytea type mapping to byte[] , ByteBuffer , R2dbc Blob |
r2dbc-migrate | R2dbc Migrate example |
auditing | Spring Data R2dbc Auditing example |
kotlin-co | Kotlin Coroutines example |
jooq | R2dbc and JOOQ example |
jooq-kotlin-co-gradle | R2dbc/JOOQ/Kotlin Coroutines and Gradle generator config example |
bookstore | (WIP) An example to track the associations support of Spring Data R2dbc |
Reference
- pgjdbc/r2dbc-postgresql
- R2dbc spec
- A Practical Guide to MySQL JSON Data Type By Example
- Convert between Java enums and PostgreSQL enums
- Java & Postgres enums - How do I make them work together for update?
- How to delete an enum type value in postgres?
- Create a type if not exist Postgresql
- jOOQ#12218: Reactive transaction with Spring and R2dbc