-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-6 - More reference documentation.
- Loading branch information
Showing
6 changed files
with
211 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,81 @@ | ||
[[documentation]] | ||
= Documenting Application Modules | ||
|
||
[[documentation.subheadline]] | ||
== Subheadline | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. | ||
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. | ||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. | ||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
The application module model created via `ApplicationModules` can be used to create documentation snippets for inclusion into developer documentation written in Asciidoc. | ||
Spring Modulith's `Documenter` abstraction can produce two different kinds of snippets: | ||
|
||
* C4 and UML component diagrams describing the relationships between the individual application modules | ||
* A so called __Application Module Canvas__, a tabular overview about the module and the most relevant elements in those (Spring beans, aggregate roots, events published and listened to as well as configuration properties). | ||
|
||
[[documentation.component-diagrams]] | ||
== Generating Application Module Component diagrams | ||
|
||
The documentation snippets can be generated by handing the `ApplicationModules` instance into a `Documenter`. | ||
|
||
.Generating application module component diagrams using `Documenter` | ||
[source, java] | ||
---- | ||
class DocumentationTests { | ||
ApplicationModules modules = ApplicationModules.of(Application.class); | ||
@Test | ||
void writeDocumentationSnippets() { | ||
new Documenter(modules) | ||
.writeModulesAsPlantUml() | ||
.writeIndividualModulesAsPlantUml(); | ||
} | ||
} | ||
---- | ||
|
||
The first call on `Documenter` will generate a C4 component diagram containin all modules within the system. | ||
The second call will create additional diagrams that only include the individual module and the ones they directly depend on on the canvas. | ||
|
||
[[documentation.component-diagrams.uml]] | ||
=== Using Traditional UML Component Diagrams | ||
|
||
If you prefer the traditional UML style component diagrams, tweak the `DiagramOptions` to rather use that style as follows: | ||
|
||
[source, java] | ||
---- | ||
DiagramOptions.defaults() | ||
.withStyle(DiagramStyle.UML); | ||
---- | ||
|
||
This will cause the diagrams to look like this: | ||
|
||
TODO: Add diagram | ||
|
||
[[documentation.application-module-canvas]] | ||
== Generating Application Module Canvases | ||
|
||
The Application Module Canvases can be generated by calling `Documenter.writeModuleCanvases()`: | ||
|
||
.Generating application module component diagrams using `Documenter` | ||
[source, java] | ||
---- | ||
class DocumentationTests { | ||
ApplicationModules modules = ApplicationModules.of(Application.class); | ||
@Test | ||
void writeDocumentationSnippets() { | ||
new Documenter(modules) | ||
.writeModuleCanvases(); | ||
} | ||
} | ||
---- | ||
|
||
A canvas generated looks like this: | ||
|
||
TODO: Include generated canvas | ||
|
||
It consists of the following sections: | ||
* __The application module's name and base package.__ | ||
* __The Spring beans exposed by the application module, grouped by stereotype.__ -- In other words beans that are located in either the API package or any <<fundamentals.modules.named-interface, named interface package>>. | ||
* __Exposed aggregate roots__ | ||
* __Application events published by the module__ -- Those event types need to be demarcated using jMolecules `@DomainEvent` or implement its `DomainEvent` interface. | ||
* __Application events listened to by the module__ -- Derived from methods annotated with Spring's `@EventListener`, `@TransactionalEventListener` or beans implementing `ApplicationListener`. | ||
* __Configuration properties__ -- Requires the usage of the `spring-boot-configuration-processor` artifact to extract the metadata attached to the properties. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters