Spring Data R2DBC

On behalf of the community and everyone who contributed, I’m delighted to announce the availability of the second milestone of Spring Data R2DBC 1.0. It is based on the recently released Moore M4 release and R2DBC 0.8.0.M8 release. Please note that Spring Data R2DBC is released outside of the Moore release train and it will be part of the next release train Neumann.

Spring Data R2DBC ships with 32 tickets fixed. The most notable features are:

Support for MySQL by using jasync-sql.

Reactive transaction manager.

Fluent API for insert / update / delete operations.

/ / operations. Coroutine extensions.

Support for custom conversions.

Named parameters that are translated to native bind markers by using Dialect instances.

instances. Support for single-column projections for simple types.

Refactored package structure.

If you use Maven, include the following lines in your pom.xml to use Spring Data R2DBC 1.0 M2 in your project:

<dependencies> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-r2dbc</artifactId> <version>1.0.0.M2</version> </dependency> </dependencies> <!-- R2DBC 0.8.0.M8 required --> <dependencyManagement> <dependencies> <dependency> <groupId>io.r2dbc</groupId> <artifactId>r2dbc-bom</artifactId> <version>Arabba-M8</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <repositories> <repository> <id>spring-milestone</id> <url>https://repo.spring.io/milestone</url> </repository> </repositories>

Spring Boot Autoconfiguration and Actuator

Together with this release, I’d also like to announce a milestone release of Spring Boot support for R2DBC 0.1.0.M1. This is an experimental Spring Boot module that provides auto-configuration and actuator support. It is marked as experimental, as this support is likely to get merged into a future Spring Boot release eventually.

Here’s what you get from the experimental Spring Boot support for R2DBC:

URL-based configuration of R2DBC ConnectionFactory ( spring.r2dbc.url=rdbc:postgresql://<server>:<port>/<database> ).

( ). Embedded database support for H2. H2 is configured for both R2DBC and JDBC access when r2dbc-h2 and spring-jdbc are available.

and are available. Connection pool support ( spring.r2dbc.pool.initial-size , spring.r2dbc.pool.max-size , spring.r2dbc.validation-query ).

, , ). Actuator support by exposing a reactive ConnectionFactoryHealthIndicator .

. Configuration of R2dbcConnectionManager enabling reactive @Transactional .

enabling reactive . Configuration of TransactionalOperator bean.

bean. Configuration of r2dbc-client by exposing a R2dbc bean.

<dependencies> <dependency> <groupId>org.springframework.boot.experimental</groupId> <artifactId>spring-boot-starter-data-r2dbc</artifactId> <version>0.1.0.M1</version> </dependency> <dependency> <groupId>org.springframework.boot.experimental</groupId> <artifactId>spring-boot-actuator-autoconfigure-r2dbc</artifactId> <version>0.1.0.M1</version> </dependency> <dependency> <groupId>io.r2dbc</groupId> <artifactId>r2dbc-postgresql</artifactId> <version>0.8.0.M8</version> <scope>runtime</scope> </dependency> <!-- Enable for connection pooling --> <dependency> <groupId>io.r2dbc</groupId> <artifactId>r2dbc-pool</artifactId> <scope>runtime</scope> </dependency> </dependencies> <repositories> <repository> <id>spring-milestone</id> <url>https://repo.spring.io/milestone</url> </repository> </repositories>

The repository readme and our documentation are the best places to get you started. Also, make sure to check out our Spring WebFlux/R2DBC/H2 example.

Next steps

R2DBC continues to evolve. We expect another series of R2DBC releases in the October timeframe so that we can pick up these in Spring Data R2DBC and eventually ship a release candidate. Our backlog contains a series of refinements around dialect support for an improved extensibility model, and we look forward to allowing for query interception to alter bindings and SQL statements before they are sent to a database.

To round things off, here are links to the changelog, GitHub repository, and docs: