This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Modulith 1.1.4!

Appendix

Appendix A: Spring Modulith Configuration Properties

Property Default value Description

spring.modulith.default-async-termination

true

Whether to configure defaults for the async processing termination, namely to wait for task completion for 2 seconds. See TaskExecutionProperties for details.

spring.modulith.events.externalization.enabled

true

Whether to enable event externalization.

spring.modulith.events.jdbc.schema-initialization.enabled

false

Whether to initialize the JDBC event publication schema.

spring.modulith.events.kafka.json-enabled

true

Whether to enable JSON support for KafkaTemplate.

spring.modulith.events.mongodb.transaction-management.enabled

true

Whether to automatically enable transactions for MongoDB. Requires the database to be run with a replica set.

spring.modulith.events.neo4j.event-index.enabled

false

Whether to create indexes on the .

spring.modulith.events.rabbitmq.json-enabled

true

Whether to enable JSON support for RabbitTemplate.

spring.modulith.moments.enableTimeMachine

false

Whether to enable the TimeMachine.

spring.modulith.moments.granularity

HOURS

The granularity of events to publish. (HOURS, DAYS)

spring.modulith.moments.locale

Locale.getDefault()

The Locale to use when determining week boundaries.

spring.modulith.moments.zoneId

ZoneOffset.UTC

The timezone of the dates for the events being published.

spring.modulith.republish-outstanding-events-on-restart

false

Whether to republish outstanding event publications on restarts of the application.

Appendix B: Spring Modulith modules

Table 1. Spring Modulith starter POMs
Starter Typical scope Includes

spring-modulith-starter-core

compile

  • spring-modulith-api

  • spring-modulith-moments

  • spring-modulith-core (runtime)

  • spring-modulith-runtime (runtime)

spring-modulith-starter-insight

runtime

  • spring-modulith-actuator (runtime)

  • spring-modulith-observability (runtime)

  • spring-boot-starter-actuator (runtime)

spring-modulith-starter-jdbc

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core (runtime)

  • spring-modulith-events-jdbc (runtime)

  • spring-modulith-events-jackson (runtime)

spring-modulith-starter-jpa

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core (runtime)

  • spring-modulith-events-jpa (runtime)

  • spring-modulith-events-jackson (runtime)

spring-modulith-starter-mongodb

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core (runtime)

  • spring-modulith-events-mongodb (runtime)

  • spring-modulith-events-jackson (runtime)

spring-modulith-starter-test

test

  • spring-modulith-docs

  • spring-modulith-test

Table 2. Individual Spring Modulith JARs
Module Typical scope Description

spring-modulith-actuator

runtime

A Spring Boot actuator to expose the application module structure via an actuator.

spring-modulith-api

compile

The abstractions to be used in your production code to customize Spring Modulith’s default behavior.

spring-modulith-core

runtime

The core application module model and API.

spring-modulith-docs

test

The Documenter API to create Asciidoctor and PlantUML documentation from the module model.

spring-modulith-events-amqp

runtime

Event externalization support for AMQP.

spring-modulith-events-api

runtime

API to customize the event features of Spring Modulith.

spring-modulith-events-core

runtime

The core implementation of the event publication registry as well as the integration abstractions EventPublicationRegistry and EventPublicationSerializer.

spring-modulith-events-jackson

runtime

A Jackson-based implementation of the EventPublicationSerializer.

spring-modulith-events-jdbc

runtime

A JDBC-based implementation of the EventPublicationRegistry.

spring-modulith-events-jms

runtime

Event externalization support for JMS.

spring-modulith-events-jpa

runtime

A JPA-based implementation of the EventPublicationRegistry.

spring-modulith-events-kafka

runtime

Event externalization support for Kafka.

spring-modulith-events-mongodb

runtime

A MongoDB-based implementation of the EventPublicationRegistry.

spring-modulith-moments

compile

The Passage of Time events implementation described here.

spring-modulith-runtime

runtime

Support to bootstrap an ApplicationModules instance at runtime. Usually not directly depended on but transitively used by spring-modulith-actuator and spring-modulith-observability.

spring-modulith-observability

runtime

Observability infrastructure described here.

Appendix C: Event publication registry schemas

The JDBC-based event publication registry support expects the following database schemas to be present in the database. If you would like Spring Modulith to create the schema for you, set the application property spring.modulith.events.jdbc-schema-initialization.enabled to true.

H2

CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION
(
  ID               UUID NOT NULL,
  COMPLETION_DATE  TIMESTAMP(9) WITH TIME ZONE,
  EVENT_TYPE       VARCHAR(512) NOT NULL,
  LISTENER_ID      VARCHAR(512) NOT NULL,
  PUBLICATION_DATE TIMESTAMP(9) WITH TIME ZONE NOT NULL,
  SERIALIZED_EVENT VARCHAR(4000) NOT NULL,
  PRIMARY KEY (ID)
);
CREATE INDEX IF NOT EXISTS EVENT_PUBLICATION_BY_LISTENER_ID_AND_SERIALIZED_EVENT_IDX ON EVENT_PUBLICATION (LISTENER_ID, SERIALIZED_EVENT);
CREATE INDEX IF NOT EXISTS EVENT_PUBLICATION_BY_COMPLETION_DATE_IDX ON EVENT_PUBLICATION (COMPLETION_DATE);

HSQLDB

CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION
(
  ID               UUID NOT NULL,
  COMPLETION_DATE  TIMESTAMP(9),
  EVENT_TYPE       VARCHAR(512) NOT NULL,
  LISTENER_ID      VARCHAR(512) NOT NULL,
  PUBLICATION_DATE TIMESTAMP(9) NOT NULL,
  SERIALIZED_EVENT VARCHAR(4000) NOT NULL,
  PRIMARY KEY (ID)
);
CREATE INDEX IF NOT EXISTS EVENT_PUBLICATION_BY_LISTENER_ID_AND_SERIALIZED_EVENT_IDX ON EVENT_PUBLICATION (LISTENER_ID, SERIALIZED_EVENT);
CREATE INDEX IF NOT EXISTS EVENT_PUBLICATION_BY_COMPLETION_DATE_IDX ON EVENT_PUBLICATION (COMPLETION_DATE);

MySQL

CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION
(
  ID               VARCHAR(36) NOT NULL,
  LISTENER_ID      VARCHAR(512) NOT NULL,
  EVENT_TYPE       VARCHAR(512) NOT NULL,
  SERIALIZED_EVENT VARCHAR(4000) NOT NULL,
  PUBLICATION_DATE TIMESTAMP(6) NOT NULL,
  COMPLETION_DATE  TIMESTAMP(6) DEFAULT NULL NULL,
  PRIMARY KEY (ID),
  INDEX EVENT_PUBLICATION_BY_COMPLETION_DATE_IDX (COMPLETION_DATE)
);

PostgreSQL

CREATE TABLE IF NOT EXISTS event_publication
(
  id               UUID NOT NULL,
  listener_id      TEXT NOT NULL,
  event_type       TEXT NOT NULL,
  serialized_event TEXT NOT NULL,
  publication_date TIMESTAMP WITH TIME ZONE NOT NULL,
  completion_date  TIMESTAMP WITH TIME ZONE,
  PRIMARY KEY (id)
);
CREATE INDEX IF NOT EXISTS event_publication_by_listener_id_and_serialized_event_idx ON event_publication (listener_id, serialized_event);
CREATE INDEX IF NOT EXISTS event_publication_by_completion_date_idx ON event_publication (completion_date);

Appendix D: Migrating from Moduliths

  • o.m.model.Modules has been renamed to o.s.m.model.ApplicationModules

  • o.m.model.ModuleDetectionStrategy has been renamed to o.s.m.model.ApplicationModuleDetectionStrategy

  • @o.m.test.ModuleTest has been renamed to @o.s.m.test.ApplicationModuleTest

  • o.m.docs.Documenter.Options has been renamed to o.s.m.docs.Documenter.DiagramOptions

  • The diagram style of component diagrams now defaults to DiagramStyle.C4 (override by calling DiagramOptions.withStyle(DiagramStyle.UML))

  • The module canvas hides non exposed types by default. To include application-module-internal types in the canvas, configure CanvasOptions to ….revealInternals().

  • The output folder for component diagrams and application module canvases has moved from moduliths-docs to spring-modulith-docs located in your build’s target folder (such as target for Maven).