Skip to content

Latest commit

 

History

History
69 lines (44 loc) · 2.24 KB

File metadata and controls

69 lines (44 loc) · 2.24 KB

spring-modulith

Sample Spring Boot 4 application structured with Spring Modulith 2.0.6: logical modules, structural verification, JDBC-backed event publication metadata, and optional Postgres via Docker Compose.

Requirements

  • Java 21 (aligned with pom.xml)
  • Docker (only if you use the docker profile for Postgres)

Run

./mvnw spring-boot:run

On Windows:

.\mvnw.cmd spring-boot:run

Default configuration uses file-based H2 under ./data/ (see application.properties). Docker Compose integration is disabled by default so the app does not block waiting for Docker.

Postgres + Docker Compose

.\mvnw.cmd spring-boot:run "-Dspring-boot.run.profiles=docker"

This uses compose.yaml and application-docker.yaml (Postgres on localhost:5432).

Try the API

GET http://localhost:8080/orders/demo?sku=SKU-1

Tests

.\mvnw.cmd test

ModulithStructureTests runs ApplicationModules.verify() so module boundaries and allowed dependencies stay consistent with the layout described in the Spring Modulith fundamentals.

Modules

Package Role
com.example.modulith Application entrypoint and shared web advice
com.example.modulith.inventory Inventory module API (StockQuery) and internal implementation
com.example.modulith.order Order module; allowed dependency: inventory

Observability and health

With the default port, for example:

  • http://localhost:8080/actuator/health
  • http://localhost:8080/actuator/modulith — application module graph (requires actuator exposure; see application.properties)

References

Repository

Source: github.com/LordKay-sudo/spring-modulith