Appendix

Spring Modulith Configuration Properties

Property Default value Description

spring.modulith.default-async-termination

true

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

spring.modulith.events.externalization.enabled

true

是否启用事件外部化。

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

false

是否初始化 JDBC 事件发布方案。

spring.modulith.events.kafka.json-enabled

true

是否为 KafkaTemplate 启用 JSON 支持。

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

true

是否为 MongoDB 自动启用事务。需要使用复制集运行数据库。

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

false

是否在 . 上创建索引。

spring.modulith.events.rabbitmq.json-enabled

true

是否为 RabbitTemplate 启用 JSON 支持。

spring.modulith.moments.enableTimeMachine

false

是否启用 TimeMachine

spring.modulith.moments.granularity

HOURS

要发布的事件颗粒度。(HOURS, DAYS)

spring.modulith.moments.locale

Locale.getDefault()

用于确定周界别的 Locale

spring.modulith.moments.zoneId

ZoneOffset.UTC

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

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

false

是否要在应用程序重新启动时重新发布尚未解决的事件出版物。

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 (运行时)* 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-test

test

* spring-modulith-docs * spring-modulith-test

Table 2. Individual Spring Modulith JARs
Module Typical scope Description

spring-modulith-actuator

runtime

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

spring-modulith-api

compile

要用于生产代码的抽象,以自定义 Spring Modulith 的默认行为。

spring-modulith-core

runtime

核心应用程序模块模型和 API。

spring-modulith-docs

test

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

spring-modulith-events-amqp

runtime

AMQP 的事件外部化支持。

spring-modulith-events-api

runtime

API,用于自定义 Spring Modulith 的事件功能。

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-moments

compile

here中描述的时间事件传递实现。

spring-modulith-runtime

runtime

支持在运行时引导 ApplicationModules 实例。通常没有直接依赖,但 spring-modulith-actuatorspring-modulith-observability 会间接使用。

spring-modulith-observability

runtime

Observability infrastructure described observability.

Event publication registry schemas

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

H2

link:partial$spring-modulith-events-jdbc-src/main/resources/schema-h2.sql[role=include]

HSQLDB

link:partial$spring-modulith-events-jdbc-src/main/resources/schema-hsqldb.sql[role=include]

MySQL

link:partial$spring-modulith-events-jdbc-src/main/resources/schema-mysql.sql[role=include]

PostgreSQL

link:partial$spring-modulith-events-jdbc-src/main/resources/schema-postgresql.sql[role=include]

Migrating from 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.C4(通过调用 DiagramOptions.withStyle(DiagramStyle.UML) 覆盖)

  • 默认情况下,模块画布会隐藏未公开的类型。要将应用程序模块内部类型包括在画布中,请将 CanvasOptions 配置为 ….revealInternals()

  • 组件图和应用程序模块画布的输出文件夹已从 moduliths-docs 移至构建目标文件夹中的 spring-modulith-docs(例如 Maven 中的 target)。