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:
application.properties
# 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:
application.properties
spring.r2dbc.url=rdbc:h2:mem:///<database>?options=DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.r2dbc.username=…
spring.r2dbc.password=…
Configuration file:
application.properties
spring.r2dbc.url=rdbc:h2:file:///<path>/<to>/<database>?options=DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.r2dbc.username=…
spring.r2dbc.password=…
Dependencies:
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>
</dependency>
Configuration:
application.properties
spring.r2dbc.url=rdbc:postgresql://<server>:<port>/<database>
spring.r2dbc.username=…
spring.r2dbc.password=…