Building blocks & stereotypes
An aggregate is a cluster of associated objects — a root entity together with the entities and value objects it owns — treated as a single unit for data changes. The aggregate root is the only entry point and enforces the invariants that must hold across the cluster; each aggregate is the boundary of one transaction and one unit of consistency. Value objects and child entities are the other core building blocks of the domain model.
Spring DDD’s annotations are provided by the spring-ddd-annotations, spring-ddd-cqrs, spring-ddd-eventsourcing, and spring-ddd-domain-events libraries.
Each annotation drives concrete framework behaviour and carries the matching jMolecules stereotype as a meta-annotation,
so the domain model stays legible to jMolecules-aware tooling (ArchUnit, Spring Modulith) without a direct jMolecules compile dependency.
Spring DDD annotations
| Annotation | Module | Package | jMolecules stereotype |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
— |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
— |
Meta-annotation detection
The framework detects annotations via Spring’s meta-annotation resolution, not by exact type.
You can define your own annotation meta-annotated with @Command, @Query, or @DomainEvent and the framework detects it automatically — no additional registration required.
import de.dwittkoetter.ddd.annotation.Command
@Command(namespace = "banking")
annotation class BankingCommand
A class annotated with @BankingCommand is treated as a command everywhere Spring DDD inspects the type.
jMolecules annotations used as-is
The jMolecules DDD and CQRS annotations are on the classpath transitively. Use them directly to mark entities, value objects, and query models:
| Annotation | Package |
|---|---|
|
|
|
|
|
|