DDD & REST - Domain Driven APIs for the Web
summary
Domain aggregates map to REST resources so repositories become collection/item URIs, with spring data rest and spring hateoas used to expose HAL hypermedia and navigation links. A Spring Boot example implements a coffee-order flow (create → pay → prepare → acknowledge) with a HAL browser and automated tests that create two orders, follow a discovered payment link, and assert a 405 when cancel is attempted after payment. Uses Lombok, Jackson customizations, ETag/Last-Modified headers, resource processors, and Spring REST Docs; the demo and tests run and demonstrate the approach.
AI-written summary · about
chapters (15)
- 0:00Start
- 2:14What does it take to bridge the worlds of DDD & REST?
- 6:04Entities & Repositories
- 9:19Aggregates form nice representation boundaries.
- 11:38Try to avoid bi-directional relationships.
- 14:02If you're calling two setters in a row, you're missing a concept.
- 15:14Domain events as state transitions.
- 17:40Representation design matters
- 19:45Hypermedia
- 21:33Trading domain knowledge with protocol complexity in clients.
- 21:53Reducing decisions in clients to whether a link is present or not.
- 23:12Prefer explicit state transitions over poking at your resources using PATCH
- 34:44Jackson Customizations Externalize tweaks to the general JSON design
- 35:19Spring Data REST for the CRUDdy parts.
- 42:38Questions?
related talks
55mFrom REST to Hypermedia APIs with Spring
46mGet HATEOAS and Hypermedia right with Spring
53mDomain-Driven REST
51mREST beyond the obvious – API design for ever evolving systems
50mSpring's unexpected features
49mDDD Strategic Design with Spring Boot
21mBuilding Flexible APIs with Spring HATEOAS
59mFrom CRUD to Hypermedia API with Spring
