This experimental project provides a simple way to try the new R2DBC support through R2DBC Client and Spring Data R2DBC.
-
spring-boot-starter-r2dbc
: Starter using R2DBC Client. -
spring-boot-starter-data-r2dbc
: Starter using Spring Data R2DBC
Dependencies:
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-h2</artifactId>
</dependency>
Configuration embedded mode:
# Nothing to do here.
Note
|
Spring Boot has support for embedded H2 databases using the JDBC interfacing option. Spring Boot’s R2DBC configuration picks up H2 configuration details to ensure all R2DBC operations are executed on the same database instance. |
Configuration in-memory:
spring.r2dbc.url=r2dbc:h2:mem:///<database>?options=DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.r2dbc.username=…
spring.r2dbc.password=…
Configuration file:
spring.r2dbc.url=r2dbc:h2:file:///<path>/<to>/<database>?options=DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.r2dbc.username=…
spring.r2dbc.password=…
Dependencies (pulled from jitpack.io):
<dependency>
<groupId>com.github.mirromutth</groupId>
<artifactId>r2dbc-mysql</artifactId>
</dependency>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Configuration:
spring.r2dbc.url=r2dbc:mysql://<server>:<port>/<database>
spring.r2dbc.username=…
spring.r2dbc.password=…
Dependencies:
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>
</dependency>
Configuration:
spring.r2dbc.url=r2dbc:postgresql://<server>:<port>/<database>
spring.r2dbc.username=…
spring.r2dbc.password=…