R2D1 / DOCS

Spring Boot 4

Available in 1.8.0. The Spring Boot integration is published to Maven Central as two artifacts: the starter and its separately published auto-configuration module.

Dependency

Add the r2d1-spring-boot-starter artifact to a Spring Boot 4.0.6 application running on Java 21 or later:

dependencies {
    implementation("dev.nexcraft:r2d1-spring-boot-starter:1.8.0")
}

The starter depends on the separately published r2d1-spring-boot-autoconfigure module. Use the starter for normal applications; use the auto-configuration module directly when composing a custom starter.

What it configures

Set r2d1.enabled=true to activate the integration. The configuration supports R2 or filesystem document storage and D1 or JDBC indexing, while preserving the framework-neutral R2D1 collection API.

JDBC uses platform-thread execution by default. Select virtual-thread execution explicitly only on a Java 25 runtime; the integration does not provide a fallback for older runtimes.

Resource ownership

Existing application DataSource, Executor, S3AsyncClient, and HttpClient beans are reused when selected by name or as the unique or @Primary bean. Application-owned resources are not closed by the integration. Resources created by the integration are closed with its managed beans.

Scope

Spring Data repositories, transactions, AOP, controllers, retry and compensation policies, R2DBC, server lifecycle, and connection-pool management are outside these modules. Native-image hints are not included until a concrete Spring AOT requirement is verified.