Appearance
Spring Boot example (minimal CRUD service)
This example demonstrates the minimal SpringBoot target platform as generated by JoinedWorkz — including:
- API layer (DTOs, API interface, controller)
- domain layer (domain types)
- persistence (JPA entities, repositories)
- data access service (decoupled persistence adapter)
- mapping (via MapStruct)
It shows what a fully generated baseline looks like before adding custom handlers or manually implemented services.
1. Repository and download
The complete example is available in the GitLab repository:
https://gitlab.com/joinedworkz/joinedworkz-examples/-/tree/main
Module: example-spring-boot
It contains both:
- the CMN model defining API & domain types
- the generated Spring Boot application
2. Project structure
After generation you will find the following packages:
| Package | Purpose |
|---|---|
entity | JPA entities (storage model) |
repository | Spring Data repositories |
das | DataAccessService layer (XxxDataAccessService) |
dto | API request/response DTOs |
mapper | MapStruct mapper interfaces & implementations |
api | API interface (controller contract) |
controller | REST controllers |
This layout follows the conventions from:
→ SpringBoot target platform design
3. Running the example
Requirements:
- Java 21+
- Maven 3.8+
Build & run:
sh
mvn clean install
mvn spring-boot:runService listens on port 8080
OpenAPI UI (if enabled):http://localhost:8080/swagger-ui.html
4. Request flow
A typical request flows through:
- Controller receives request
- MapStruct maps API DTO → domain type
- DataAccessService interacts with repository
- JPA entities → data objects
- MapStruct maps domain type → API DTO
- Response returned
5. Example model (simplified)
cmn
type<entity> Customer {
internalId**: Id
firstName*: Name
lastName*: Name
email: String(255)
}
type CustomerView {
...Customer exclude internalId
}
resource /customers as CustomerView[] by internalId {
query()
create() consumes=CustomerView
read readCustomer()
update()
delete()
}6. Extending the example
Typical next steps:
- implement custom handlers
- add domain services
- introduce additional API views
- route layers to separate Maven modules
- add gateways for external systems
For deeper information:
- SpringBoot target platform design
- SpringBoot profile & canonical modeling
- Spring Boot facility
