Skip to content

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 services
  • api – request/response DTOs + resources
  • backend – 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 by layer

Route core and api to different modules:

properties
outlet.generatedJavaSource.api.directory=../webapp/src/generated/java

6. Glue library and package overrides

Use:

properties
override-package.org.iworkz.core=...

7. Putting it together

  1. Model domain in core
  2. Model API in api
  3. Add handlers or CRUD helpers
  4. Configure outlets
  5. Generate