@@ -13,7 +13,11 @@ Spring Modulith's `Documenter` abstraction can produce two different kinds of sn
13
13
The documentation snippets can be generated by handing the `ApplicationModules` instance into a `Documenter`.
14
14
15
15
.Generating application module component diagrams using `Documenter`
16
- [source, java]
16
+ [tabs]
17
+ ======
18
+ Java::
19
+ +
20
+ [source, java, role="primary"]
17
21
----
18
22
class DocumentationTests {
19
23
@@ -28,6 +32,22 @@ class DocumentationTests {
28
32
}
29
33
}
30
34
----
35
+ Kotlin::
36
+ +
37
+ [source, kotlin, role="secondary"]
38
+ ----
39
+ class DocumentationTests {
40
+ private val modules = ApplicationModules.of(Application::class)
41
+
42
+ @Test
43
+ fun writeDocumentationSnippets() {
44
+ Documenter(modules)
45
+ .writeModulesAsPlantUml()
46
+ .writeIndividualModulesAsPlantUml()
47
+ }
48
+ }
49
+ ----
50
+ ======
31
51
32
52
The first call on `Documenter` will generate a C4 component diagram containing all modules within the system.
33
53
@@ -90,13 +110,23 @@ SHOW_LEGEND()
90
110
=== Using Traditional UML Component Diagrams
91
111
92
112
If you prefer the traditional UML style component diagrams, tweak the `DiagramOptions` to rather use that style as follows:
93
-
94
- [source, java]
113
+ [tabs]
114
+ ======
115
+ Java::
116
+ +
117
+ [source, java, role="primary"]
95
118
----
96
119
DiagramOptions.defaults()
97
120
.withStyle(DiagramStyle.UML);
98
121
----
99
-
122
+ Kotlin::
123
+ +
124
+ [source, kotlin, role="secondary"]
125
+ ----
126
+ DiagramOptions.defaults()
127
+ .withStyle(DiagramStyle.UML)
128
+ ----
129
+ ======
100
130
This will cause the diagrams to look like this:
101
131
102
132
.All modules and their relationships rendered as UML component diagram
@@ -184,7 +214,11 @@ package "Application" <<Container>> {
184
214
The Application Module Canvases can be generated by calling `Documenter.writeModuleCanvases()`:
185
215
186
216
.Generating application module canvases using `Documenter`
187
- [source, java]
217
+ [tabs]
218
+ ======
219
+ Java::
220
+ +
221
+ [source, java, role="primary"]
188
222
----
189
223
class DocumentationTests {
190
224
@@ -198,7 +232,22 @@ class DocumentationTests {
198
232
}
199
233
}
200
234
----
235
+ Kotlin::
236
+ +
237
+ [source, kotlin, role="secondary"]
238
+ ----
239
+ class DocumentationTests {
240
+
241
+ private val modules = ApplicationModules.of(Application::class)
201
242
243
+ @Test
244
+ fun writeDocumentationSnippets() {
245
+ Documenter(modules)
246
+ .writeModuleCanvases()
247
+ }
248
+ }
249
+ ----
250
+ ======
202
251
By default, the documentation will be generated to `spring-modulith-docs` folder in your build system's build folder.
203
252
A generated canvas looks like this:
204
253
0 commit comments