Installation
Spring DDD ships as Spring Boot starters. Add the ones that match your architecture.
Obtaining the artifacts
| Spring DDD is not yet published to a Maven repository. |
Until it is, build it from source with a Gradle composite build: check out the repository next to your project and include it from settings.gradle.kts.
Building the spring-ddd checkout needs JDK 25.
includeBuild("../spring-ddd")
Gradle builds the starters from the checkout and resolves their coordinates to it.
There is no BOM: declare each starter directly.
The starters bring Spring Boot’s dependency versions with them, so a driver such as org.postgresql:postgresql needs no version.
dependencies {
implementation("de.dwittkoetter:spring-ddd-starter-jpa:0.0.1-SNAPSHOT")
}
Starters
Pick the starters you need; each brings the libraries it uses, and several storage technologies can run side by side in one application.
Full-stack bundles
spring-ddd-starter-jpa-
Event sourcing, CQRS with JPA aggregates and JPA projections, sagas and domain events. The recommended starting point.
spring-ddd-starter-jdbc-
Experimental. Event sourcing, CQRS over plain JDBC without Hibernate with the experimental query store, sagas and domain events.
Single-purpose starters
Each adds one area. They combine freely with each other and with a bundle.
spring-ddd-starter-eventsourcing-jdbc-
Event sourcing over JDBC, without CQRS.
spring-ddd-starter-cqrs-jpa-
The command and query buses, JPA aggregates, and JPA projections.
spring-ddd-starter-cqrs-jdbc-query-
Experimental. The command and query buses over plain JDBC, with the query store.
spring-ddd-starter-saga-jdbc-
Sagas over JDBC, with deadlines. It includes
spring-ddd-starter-domain-events. spring-ddd-starter-domain-events-
@DomainEventHandlermethods, without event sourcing or CQRS.
Starters that connect on their own
Three pairs connect when both are on the classpath; no further dependency is needed:
-
event sourcing and a CQRS starter:
@CommandHandlermethods on event-sourced aggregates reach the command bus; -
event sourcing and
spring-ddd-starter-saga-jdbc: sagas receive event-sourced events in position order; -
a CQRS starter and
spring-ddd-starter-saga-jdbc: sagas send commands throughSagaCommands.
For example, event sourcing and CQRS with JPA aggregates, without sagas, is spring-ddd-starter-eventsourcing-jdbc and spring-ddd-starter-cqrs-jpa.
Add-ons
spring-ddd-starter-observability-
Actuator endpoints, health indicators and Micrometer metrics for the parts of Spring DDD the application uses. No other starter includes it; see Observability.
spring-ddd-starter-test-
Test support: the aggregate test fixture, waiting for projections, and database cleanup. Add it with
testImplementation; see Testing. spring-ddd-starter-domain-events-modulith-jdbc-
Domain-event delivery through Spring Modulith; see Spring Modulith Integration.
Which starters to pick
| I want | Use |
|---|---|
Event sourcing, CQRS, JPA aggregates |
|
Event sourcing and CQRS without Hibernate (experimental) |
|
Event sourcing only |
|
Event sourcing and CQRS with JPA aggregates, no sagas |
|
CQRS with JPA aggregates only |
|
CQRS without Hibernate only (experimental) |
|
Sagas next to any of the above |
add |
Domain-event handlers, no event sourcing or CQRS |
|
Next steps
-
Quick start: a runnable slice on PostgreSQL.
-
Choosing a database: what each supported engine means for the application.
-
Spring Boot integration: what Spring DDD takes from Spring Boot and what you can replace.