附录 A:Spring Shell配置属性

财产 默认值 描述

spring.modulith.default-async-termination

true

是否为异步处理终止配置默认值,即等待任务完成 2 秒。有关详细信息,请参阅。TaskExecutionProperties

spring.modulith.detection-strategy

没有

应用于检测应用程序模块的策略。 可以是 or 的自定义实现的类名(如果未配置任何内容,这也是最终的回退),也可以仅选择显式使用 或 jMolecules 注释的包。有关详细信息,请参阅自定义应用程序模块检测ApplicationModuleDetectionStrategydirect-subpackagesexplicitly-annotated@ApplicationModule@Module

spring.modulith.events.externalization.enabled

true

是否启用事件外部化。

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

false

是否初始化 JDBC 事件发布模式。

spring.modulith.events.kafka.enable-json

true

是否启用 JSON 支持。KafkaTemplate

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

true

是否自动启用 MongoDB 事务。要求使用副本集运行数据库。

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

false

是否在 .

spring.modulith.events.rabbitmq.enable-json

true

是否启用 JSON 支持。RabbitTemplate

spring.modulith.moments.enableTimeMachine

false

是否开启 TimeMachine.

spring.modulith.moments.granularity

HOURS

要发布的事件的粒度。(,HOURSDAYS)

spring.modulith.moments.locale

Locale.getDefault()

确定周边界时使用的 to。Locale

spring.modulith.moments.zoneId

ZoneOffset.UTC

要发布事件的日期的时区。

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

false

是否在重新启动应用程序时重新发布未完成的事件发布。

财产 默认值 描述

spring.modulith.default-async-termination

true

是否为异步处理终止配置默认值,即等待任务完成 2 秒。有关详细信息,请参阅。TaskExecutionProperties

spring.modulith.detection-strategy

没有

应用于检测应用程序模块的策略。 可以是 or 的自定义实现的类名(如果未配置任何内容,这也是最终的回退),也可以仅选择显式使用 或 jMolecules 注释的包。有关详细信息,请参阅自定义应用程序模块检测ApplicationModuleDetectionStrategydirect-subpackagesexplicitly-annotated@ApplicationModule@Module

spring.modulith.events.externalization.enabled

true

是否启用事件外部化。

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

false

是否初始化 JDBC 事件发布模式。

spring.modulith.events.kafka.enable-json

true

是否启用 JSON 支持。KafkaTemplate

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

true

是否自动启用 MongoDB 事务。要求使用副本集运行数据库。

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

false

是否在 .

spring.modulith.events.rabbitmq.enable-json

true

是否启用 JSON 支持。RabbitTemplate

spring.modulith.moments.enableTimeMachine

false

是否开启 TimeMachine.

spring.modulith.moments.granularity

HOURS

要发布的事件的粒度。(,HOURSDAYS)

spring.modulith.moments.locale

Locale.getDefault()

确定周边界时使用的 to。Locale

spring.modulith.moments.zoneId

ZoneOffset.UTC

要发布事件的日期的时区。

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

false

是否在重新启动应用程序时重新发布未完成的事件发布。

附录 B:Spring Shell模块

表 1.Spring Shell起动机 POM
起动机 典型范围 包括

spring-modulith-starter-core

compile

  • spring-modulith-api

  • spring-modulith-moments

  • spring-modulith-core(运行时)

  • spring-modulith-runtime(运行时)

spring-modulith-starter-insight

runtime

  • spring-modulith-actuator(运行时)

  • spring-modulith-observability(运行时)

  • spring-boot-starter-actuator(运行时)

spring-modulith-starter-jdbc

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core(运行时)

  • spring-modulith-events-jdbc(运行时)

  • spring-modulith-events-jackson(运行时)

spring-modulith-starter-jpa

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core(运行时)

  • spring-modulith-events-jpa(运行时)

  • spring-modulith-events-jackson(运行时)

spring-modulith-starter-mongodb

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core(运行时)

  • spring-modulith-events-mongodb(运行时)

  • spring-modulith-events-jackson(运行时)

spring-modulith-starter-neo4j

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core(运行时)

  • spring-modulith-events-neo4j(运行时)

  • spring-modulith-events-jackson(运行时)

spring-modulith-starter-test

test

  • spring-modulith-docs

  • spring-modulith-test

表 2.单个Spring Shell JAR
模块 典型范围 描述

spring-modulith-actuator

runtime

一个 Spring Boot 执行器,用于通过执行器公开应用程序模块结构。

spring-modulith-api

compile

在生产代码中使用的抽象,用于自定义 Spring Modolith 的默认行为。

spring-modulith-core

runtime

核心应用模块模型和 API。

spring-modulith-docs

test

用于从模块模型创建 Asciidoctor 和 PlantUML 文档的 API。Documenter

spring-modulith-events-amqp

runtime

对 AMQP 的事件外部化支持。

spring-modulith-events-api

runtime

自定义 Spring Modolith 事件特性的 API。

spring-modulith-events-core

runtime

事件发布注册表的核心实现以及集成抽象和 .EventPublicationRegistryEventPublicationSerializer

spring-modulith-events-jackson

runtime

基于 Jackson 的 .EventPublicationSerializer

spring-modulith-events-jdbc

runtime

基于 JDBC 的 .EventPublicationRegistry

spring-modulith-events-jms

runtime

对 JMS 的事件外部化支持。

spring-modulith-events-jpa

runtime

基于 JPA 的 .EventPublicationRegistry

spring-modulith-events-kafka

runtime

对 Kafka 的事件外部化支持。

spring-modulith-events-mongodb

runtime

基于 MongoDB 的 .EventPublicationRegistry

spring-modulith-events-neo4j

runtime

基于 Neo4j 的 .EventPublicationRegistry

spring-modulith-moments

compile

此处描述的 Passage of Time 事件实现。

spring-modulith-runtime

runtime

支持在运行时引导实例。通常不直接依赖于 和 而是传递使用 。ApplicationModulesspring-modulith-actuatorspring-modulith-observability

spring-modulith-observability

runtime

此处介绍的可观测性基础结构。

表 1.Spring Shell起动机 POM
起动机 典型范围 包括

spring-modulith-starter-core

compile

  • spring-modulith-api

  • spring-modulith-moments

  • spring-modulith-core(运行时)

  • spring-modulith-runtime(运行时)

spring-modulith-starter-insight

runtime

  • spring-modulith-actuator(运行时)

  • spring-modulith-observability(运行时)

  • spring-boot-starter-actuator(运行时)

spring-modulith-starter-jdbc

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core(运行时)

  • spring-modulith-events-jdbc(运行时)

  • spring-modulith-events-jackson(运行时)

spring-modulith-starter-jpa

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core(运行时)

  • spring-modulith-events-jpa(运行时)

  • spring-modulith-events-jackson(运行时)

spring-modulith-starter-mongodb

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core(运行时)

  • spring-modulith-events-mongodb(运行时)

  • spring-modulith-events-jackson(运行时)

spring-modulith-starter-neo4j

compile

  • spring-modulith-starter-core

  • spring-modulith-events-api

  • spring-modulith-events-core(运行时)

  • spring-modulith-events-neo4j(运行时)

  • spring-modulith-events-jackson(运行时)

spring-modulith-starter-test

test

  • spring-modulith-docs

  • spring-modulith-test

表 2.单个Spring Shell JAR
模块 典型范围 描述

spring-modulith-actuator

runtime

一个 Spring Boot 执行器,用于通过执行器公开应用程序模块结构。

spring-modulith-api

compile

在生产代码中使用的抽象,用于自定义 Spring Modolith 的默认行为。

spring-modulith-core

runtime

核心应用模块模型和 API。

spring-modulith-docs

test

用于从模块模型创建 Asciidoctor 和 PlantUML 文档的 API。Documenter

spring-modulith-events-amqp

runtime

对 AMQP 的事件外部化支持。

spring-modulith-events-api

runtime

自定义 Spring Modolith 事件特性的 API。

spring-modulith-events-core

runtime

事件发布注册表的核心实现以及集成抽象和 .EventPublicationRegistryEventPublicationSerializer

spring-modulith-events-jackson

runtime

基于 Jackson 的 .EventPublicationSerializer

spring-modulith-events-jdbc

runtime

基于 JDBC 的 .EventPublicationRegistry

spring-modulith-events-jms

runtime

对 JMS 的事件外部化支持。

spring-modulith-events-jpa

runtime

基于 JPA 的 .EventPublicationRegistry

spring-modulith-events-kafka

runtime

对 Kafka 的事件外部化支持。

spring-modulith-events-mongodb

runtime

基于 MongoDB 的 .EventPublicationRegistry

spring-modulith-events-neo4j

runtime

基于 Neo4j 的 .EventPublicationRegistry

spring-modulith-moments

compile

此处描述的 Passage of Time 事件实现。

spring-modulith-runtime

runtime

支持在运行时引导实例。通常不直接依赖于 和 而是传递使用 。ApplicationModulesspring-modulith-actuatorspring-modulith-observability

spring-modulith-observability

runtime

此处介绍的可观测性基础结构。

附录 C:事件发布注册表架构

基于 JDBC 的事件发布注册表支持要求数据库中存在以下数据库模式。 如果希望 Spring Modulith 为您创建架构,请将 application 属性设置为 。spring.modulith.events.jdbc-schema-initialization.enabledtrue

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

附录 D:从 Moduliths 迁移

  • o.m.model.Modules已重命名为o.s.m.model.ApplicationModules

  • o.m.model.ModuleDetectionStrategy已重命名为o.s.m.model.ApplicationModuleDetectionStrategy

  • @o.m.test.ModuleTest已重命名为@o.s.m.test.ApplicationModuleTest

  • o.m.docs.Documenter.Options已重命名为o.s.m.docs.Documenter.DiagramOptions

  • 组件图的图样式现在默认为 (通过调用重写DiagramStyle.C4DiagramOptions.withStyle(DiagramStyle.UML))

  • 默认情况下,模块画布隐藏非公开类型。 若要在画布中包含 application-module-internal 类型,请配置为 。CanvasOptions….revealInternals()

  • 组件关系图和应用程序模块画布的输出文件夹已从生成的目标文件夹(例如 Maven)移至位于该文件夹中。moduliths-docsspring-modulith-docstarget