|
| 1 | += Spring Modulith |
| 2 | +:docs: https://docs.spring.io/spring-modulith/docs/current-SNAPSHOT/reference/html/ |
| 3 | + |
| 4 | +Spring Modulith allows developers to build well-structured Spring Boot applications and guides developers in finding and working with link:{docs}#fundamentals.modules.application-modules[application modules] driven by the domain. |
| 5 | +It supports the link:{docs}#verification[verification] of such modular arrangements, link:{docs}#testing[integration testing] individual modules, link:{docs}#observability[observing] the application's behavior on the module level and creating link:{docs}#documentation[documentation snippets] based on the arrangement created. |
| 6 | + |
| 7 | +== Quickstart |
| 8 | + |
| 9 | +. Create a Spring Boot application on https://start.spring.io |
| 10 | +. Create a Java package arrangement that puts business modules as link:{docs}#fundamentals[direct sub-packages of the application's main package]. |
| 11 | ++ |
| 12 | +[source, text, subs="macros"] |
| 13 | +---- |
| 14 | +□ Example |
| 15 | +└─ □ src/main/java |
| 16 | + ├─ □ example <1> |
| 17 | + | └─ Application.java |
| 18 | + ├─ □ example.inventory <2> |
| 19 | + | └─ … |
| 20 | + └─ □ example.order <2> |
| 21 | + └─ … |
| 22 | +---- |
| 23 | +<1> The application root package |
| 24 | +<2> Application module packages |
| 25 | +. Create link:{docs}#fundamentals.modules.application-modules[an `ApplicationModules` model], run link:{docs}#verification[verifications] and link:{docs}#documentation[create documentation snippets]. |
| 26 | ++ |
| 27 | +[source, java] |
| 28 | +---- |
| 29 | +class ApplicationTests { |
| 30 | +
|
| 31 | + @Test |
| 32 | + void writeDocumentationSnippets() { |
| 33 | +
|
| 34 | + var modules = ApplicationModules.of(Application.class).verify(); <1> |
| 35 | +
|
| 36 | + new Documenter(modules) <2> |
| 37 | + .writeModulesAsPlantUml() |
| 38 | + .writeIndividualModulesAsPlantUml(); |
| 39 | + } |
| 40 | +} |
| 41 | +---- |
| 42 | +<1> Creates application module model and link:{docs}#verification[verifies its structure]. |
| 43 | +<2> Renders link:{docs}#documentation[Asciidoctor snippets] (component diagrams, application module canvas) to `target/modulith-docs`. |
| 44 | +. Run link:{docs}#testing[integration tests] for individual application modules. |
| 45 | ++ |
| 46 | +[source, text, subs="macros"] |
| 47 | +---- |
| 48 | +□ Example |
| 49 | +└─ □ src/test/java |
| 50 | + └─ □ example.order |
| 51 | + └─ OrderModuleIntegrationTests.java |
| 52 | +---- |
| 53 | ++ |
| 54 | +[source, java] |
| 55 | +---- |
| 56 | +@ApplicationModuleTests |
| 57 | +class OrderModuleIntegrationTests { |
| 58 | +
|
| 59 | + @Test |
| 60 | + void someTestMethod() { … } |
| 61 | +} |
| 62 | +---- |
| 63 | + |
| 64 | +== Reference documentation |
| 65 | + |
| 66 | +Find the reference documentation link:{docs}[here]. |
| 67 | + |
| 68 | +== Contributing |
| 69 | + |
| 70 | +https://help.github.com/articles/creating-a-pull-request[Pull requests] are welcome. Note, that we expect everyone to follow the https://github.com/spring-projects/.github/blob/main/CODE_OF_CONDUCT.md[code of conduct]. |
| 71 | + |
| 72 | +== License |
| 73 | +Spring Modulith is Open Source software released under the |
| 74 | +https://www.apache.org/licenses/LICENSE-2.0.html[Apache 2.0 license]. |
0 commit comments