SpringBoot profile and canonical modeling
This page explains how to model for the SpringBoot platform so that you get the target architecture described in the target platform design.
1. Layer model in CMN
Use:
core– domain types and servicesapi– request/response DTOs + resourcesbackend– components, configuration
2. Special role of the api layer
API types = external DTOs
Core types = domain types
The platform generates:
- controllers using API types
- handlers using domain types
- mapping between them via MapStruct
3. Modeling domain vs API view
Define domain entity:
cmn
type<entity> Customer {
internalId**: Id
firstName*: Name
lastName*: Name
email: String(255)
}Define API view:
cmn
type CustomerView {
...Customer exclude internalId
}Use view in resource.
4. Handler‑aware modeling
Attach handler to resource methods or method types.
CRUD helper method types exist:
- createEntity
- readEntity
- updateEntity
- queryEntities
- deleteEntity
5. Outlet routing
Route core-derived Java output and SpringBoot controller/API output through their actual outlets:
properties
outlet.generatedJavaSource.core.directory=../backend/src/generated/java
outlet.generatedApiSource.directory=../webapp/src/generated/javaThe first mapping is source-tag-specific. The second is deliberately global: the release 1.3.80 example derives its controller/API classes from an untagged component model. generatedApiSource is a separate SpringBoot outlet; it is not an api source-tag mapping of generatedJavaSource.
6. Putting it together
- Model domain in
core - Model API in
api - Add handlers or CRUD helpers
- Configure outlets
- Generate
