更進一步
VMware 提供培訓和認證,以加速您的進度。
瞭解更多Spring Modulith 允許開發者構建結構良好的 Spring Boot 應用程式,並引導開發者查詢和使用由領域驅動的應用程式模組。 它支援此類模組化安排的驗證、各個模組的整合測試、在模組級別觀察應用程式的行為以及基於建立的安排建立文件片段。
在 https://start.spring.io 上建立一個 Spring Boot 應用程式
建立一個 Java 包安排,將業務模組作為應用程式主包的直接子包。
□ Example
└─ □ src/main/java
├─ □ example <1>
│ └─ Application.java
├─ □ example.inventory <2>
│ └─ …
└─ □ example.order <2>
└─ …
應用程式根包
應用程式模組包
建立 一個 ApplicationModules
模型,執行驗證,並建立文件片段。
class ApplicationTests {
@Test
void writeDocumentationSnippets() {
var modules = ApplicationModules.of(Application.class).verify(); (1)
new Documenter(modules) (2)
.writeModulesAsPlantUml()
.writeIndividualModulesAsPlantUml();
}
}
建立應用程式模組模型並驗證其結構。
將 Asciidoctor 片段(元件圖、應用程式模組畫布)渲染到 target/modulith-docs
。
為各個應用程式模組執行整合測試。
□ Example
└─ □ src/test/java
└─ □ example.order
└─ OrderModuleIntegrationTests.java
@ApplicationModuleTests
class OrderModuleIntegrationTests {
@Test
void someTestMethod() { … }
}