Appendix

Appendix A: Spring Modulith Configuration Properties

Property Default value Description

spring.modulith.default-async-terminationspring-doc.cn

truespring-doc.cn

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

spring.modulith.detection-strategyspring-doc.cn

nonespring-doc.cn

The strategy to be applied to detect application modules. Can either be the class name of a custom implementation of ApplicationModuleDetectionStrategy or direct-subpackages (which is also the final fallback if nothing is configured) or explicitly-annotated to only select packages explicitly annotated with @ApplicationModule or jMolecules' @Module. See Customize Application Module Detection for details.spring-doc.cn

spring.modulith.events.completion-modespring-doc.cn

updatespring-doc.cn

How to mark an event publication as completed. The following values are supported:spring-doc.cn

  • update (default) — Sets the completion date on the event publication entry.spring-doc.cn

  • delete — Removes the event publication entry. Completed event publications are not available via CompletedEventPublications.spring-doc.cn

  • archive — Removes the event publication entry from the primary database abstraction (table, collection or node) and creates one in a archive (a table, collection or node of same schema). For details, see Event Publication Completion.spring-doc.cn

spring.modulith.events.externalization.enabledspring-doc.cn

truespring-doc.cn

Whether to enable event externalization.spring-doc.cn

spring.modulith.events.jdbc.schema-initialization.enabledspring-doc.cn

falsespring-doc.cn

Whether to initialize the JDBC event publication schema.spring-doc.cn

spring.modulith.events.jdbc.schemaspring-doc.cn

The schema name for the event publication table. If not specified, the table will not be schema-qualified.spring-doc.cn

spring.modulith.events.kafka.enable-jsonspring-doc.cn

truespring-doc.cn

Whether to enable JSON support for KafkaTemplate.spring-doc.cn

spring.modulith.events.mongodb.transaction-management.enabledspring-doc.cn

truespring-doc.cn

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

spring.modulith.events.neo4j.event-index.enabledspring-doc.cn

falsespring-doc.cn

Whether to create indexes on the .spring-doc.cn

spring.modulith.events.rabbitmq.enable-jsonspring-doc.cn

truespring-doc.cn

Whether to enable JSON support for RabbitTemplate.spring-doc.cn

spring.modulith.events.republish-outstanding-events-on-restartspring-doc.cn

falsespring-doc.cn

Whether to republish outstanding event publications on restarts of the application. Usually not recommended in multi-instance deployments as other instances might still be processing events.spring-doc.cn

spring.modulith.moments.enableTimeMachinespring-doc.cn

falsespring-doc.cn

Whether to enable the TimeMachine.spring-doc.cn

spring.modulith.moments.granularityspring-doc.cn

HOURSspring-doc.cn

The granularity of events to publish. (HOURS, DAYS)spring-doc.cn

spring.modulith.moments.localespring-doc.cn

Locale.getDefault()spring-doc.cn

The Locale to use when determining week boundaries.spring-doc.cn

spring.modulith.moments.zoneIdspring-doc.cn

ZoneOffset.UTCspring-doc.cn

The timezone of the dates for the events being published.spring-doc.cn

spring.modulith.republish-outstanding-events-on-restartspring-doc.cn

falsespring-doc.cn

Deprecated as of 1.3. Prefer spring.modulith.events.republish-outstanding-events-on-restart.spring-doc.cn

spring.modulith.test.file-modification-detectorspring-doc.cn

nonespring-doc.cn

This can either be one of the predefined values uncommitted-changes, reference-commit, default or the fully-qualified class name of a FileModificationDetector that will be used to inspect which files of the projects have been changed. As the name suggests, uncommitted-changes will only consider changed files not already committed. reference-commit will consider all files changed since a given Git commit provided via spring.modulith.test.reference-commit, particularly useful CI environments in which that property could point to the commit hash of the last successful build. default detects all uncomitted changes and ones that have not been pushed to the current branch’s tracking branch which is primarily useful for local development.spring-doc.cn

spring.modulith.test.reference-commitspring-doc.cn

nonespring-doc.cn

The commit hash of to which to calculate the set of changed files. Usually propagated in CI environments to consider all changes since the last successful build.spring-doc.cn

Appendix B: Spring Modulith modules

Table 1. Spring Modulith starter POMs
Starter Typical scope Includes

spring-modulith-starter-corespring-doc.cn

compilespring-doc.cn

spring-modulith-starter-insightspring-doc.cn

runtimespring-doc.cn

spring-modulith-starter-jdbcspring-doc.cn

compilespring-doc.cn

spring-modulith-starter-jpaspring-doc.cn

compilespring-doc.cn

spring-modulith-starter-mongodbspring-doc.cn

compilespring-doc.cn

spring-modulith-starter-neo4jspring-doc.cn

compilespring-doc.cn

spring-modulith-starter-testspring-doc.cn

testspring-doc.cn

Table 2. Individual Spring Modulith JARs
Module Typical scope Description

spring-modulith-actuatorspring-doc.cn

runtimespring-doc.cn

A Spring Boot actuator to expose the application module structure via an actuator.spring-doc.cn

spring-modulith-apispring-doc.cn

compilespring-doc.cn

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

spring-modulith-aptspring-doc.cn

compilespring-doc.cn

An annotation processor to extract Javadoc for inclusion in Application Module Canvases.spring-doc.cn

spring-modulith-corespring-doc.cn

runtimespring-doc.cn

The core application module model and API.spring-doc.cn

spring-modulith-docsspring-doc.cn

testspring-doc.cn

The Documenter API to create Asciidoctor and PlantUML documentation from the module model.spring-doc.cn

spring-modulith-events-amqpspring-doc.cn

runtimespring-doc.cn

Event externalization support for AMQP.spring-doc.cn

spring-modulith-events-apispring-doc.cn

runtimespring-doc.cn

API to customize the event features of Spring Modulith.spring-doc.cn

spring-modulith-events-corespring-doc.cn

runtimespring-doc.cn

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

spring-modulith-events-jacksonspring-doc.cn

runtimespring-doc.cn

A Jackson-based implementation of the EventPublicationSerializer.spring-doc.cn

spring-modulith-events-jdbcspring-doc.cn

runtimespring-doc.cn

A JDBC-based implementation of the EventPublicationRegistry.spring-doc.cn

spring-modulith-events-jmsspring-doc.cn

runtimespring-doc.cn

Event externalization support for JMS.spring-doc.cn

spring-modulith-events-jpaspring-doc.cn

runtimespring-doc.cn

A JPA-based implementation of the EventPublicationRegistry.spring-doc.cn

spring-modulith-events-kafkaspring-doc.cn

runtimespring-doc.cn

Event externalization support for Kafka.spring-doc.cn

spring-modulith-events-messagingspring-doc.cn

runtimespring-doc.cn

Event externalization support into Spring Messaging MessageChannels.spring-doc.cn

spring-modulith-events-mongodbspring-doc.cn

runtimespring-doc.cn

A MongoDB-based implementation of the EventPublicationRegistry.spring-doc.cn

spring-modulith-events-neo4jspring-doc.cn

runtimespring-doc.cn

A Neo4j-based implementation of the EventPublicationRegistry.spring-doc.cn

spring-modulith-junitspring-doc.cn

testspring-doc.cn

Test execution optimizations based on the application module structure. Find more details here.spring-doc.cn

spring-modulith-momentsspring-doc.cn

compilespring-doc.cn

The Passage of Time events implementation described here.spring-doc.cn

spring-modulith-observabilityspring-doc.cn

runtimespring-doc.cn

Observability infrastructure described here.spring-doc.cn

spring-modulith-runtimespring-doc.cn

runtimespring-doc.cn

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-doc.cn

spring-modulith-testspring-doc.cn

testspring-doc.cn

Integration testing support. Find more details here.spring-doc.cn

Appendix C: Deprecated modules

Table 3. Deprecated modules table
Module Deprecated since Description

spring-modulith-events-aws-snsspring-doc.cn

1.3spring-doc.cn

Please migrate to io.awspring.cloud:spring-cloud-aws-modulith-events-sns. See this linkspring-doc.cn

spring-modulith-events-aws-sqsspring-doc.cn

1.3spring-doc.cn

Please migrate to io.awspring.cloud:spring-cloud-aws-modulith-events-sqs. See this linkspring-doc.cn

Appendix D: 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.spring-doc.cn

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);

MariaDB

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)
);

Microsoft SQL Server

IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'EVENT_PUBLICATION')
CREATE TABLE EVENT_PUBLICATION
(
  ID               VARCHAR(36) NOT NULL,
  LISTENER_ID      VARCHAR(512) NOT NULL,
  EVENT_TYPE       VARCHAR(512) NOT NULL,
  SERIALIZED_EVENT VARCHAR(MAX) NOT NULL,
  PUBLICATION_DATE DATETIME2(6) NOT NULL,
  COMPLETION_DATE  DATETIME2(6) NULL,
  PRIMARY KEY (ID),
  INDEX EVENT_PUBLICATION_BY_COMPLETION_DATE_IDX (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_serialized_event_hash_idx ON event_publication USING hash(serialized_event);
CREATE INDEX IF NOT EXISTS event_publication_by_completion_date_idx ON event_publication (completion_date);

Appendix E: Migrating from Moduliths

  • o.m.model.Modules has been renamed to o.s.m.model.ApplicationModulesspring-doc.cn

  • o.m.model.ModuleDetectionStrategy has been renamed to o.s.m.model.ApplicationModuleDetectionStrategyspring-doc.cn

  • @o.m.test.ModuleTest has been renamed to @o.s.m.test.ApplicationModuleTestspring-doc.cn

  • o.m.docs.Documenter.Options has been renamed to o.s.m.docs.Documenter.DiagramOptionsspring-doc.cn

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

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

  • 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).spring-doc.cn