Spring Modulith Supporting developers in implementing logical modules in Spring Boot applications, it allows application structure validation, documenting module arrangements, running integration tests for individual modules, observing module interactions at runtime, and implementing module interactions in a loosely coupled manner.

The Spring Modulith project introduces new classes and annotations but does not generate code, and its modules do not use the Java Platform Module System (JPMS), but map to pure Java packages. Modules have an API, but Spring Modulith encourages the use of Spring application events as the “primary mode of interaction”, which can be automatically persisted to the event log.

Simply put, Spring Modulith provides a set of tools that can implement cross-module calls within the same monolithic service (instead of calling APIs directly to each other) in a message-passing manner.

Spring Modulith is based on Spring Boot 3.0, Framework 6, Java 17 and JakartaEE 9, it is Moduliths The successor to the project, which uses Spring Boot 2.7, but is now retired, receiving only bugfixes until November 2023.

quick start

  1. at https://start.spring.ioCreate a Spring Boot application on

  2. Create a Java package arrangement with the business module asA direct subpackage of the application’s main package.


    
    □ Example
    └─ □ src/main/java
       ├─ □ example           <1>
       |  └─ Application.java
       ├─ □ example.inventory <2>
       |  └─ …
       └─ □ example.order     <2>
          └─ …


    1. application root package

    2. App Module Pack

  3. create ApplicationModules Model,runverifyandcreatedocument fragment.


    
    class ApplicationTests {
    
      @Test
      void writeDocumentationSnippets() {
    
        var modules = ApplicationModules.of(Application.class).verify(); (1)
    
        new Documenter(modules) (2)
          .writeModulesAsPlantUml()
          .writeIndividualModulesAsPlantUml();
      }
    }


    1. Create an application module model andverify its structure.

    2. will Asciidoctorfragment(Component Graph, Application Module Canvas) renders totarget/modulith-docs.

  4. For individual application modules runIntegration Testing.


    
    □ Example
    └─ □ src/test/java
       └─ □ example.order
          └─ OrderModuleIntegrationTests.java


    
    @ApplicationModuleTests
    class OrderModuleIntegrationTests {
    
      @Test
      void someTestMethod() { … }
    }

#Spring #Modulith #Homepage #Documentation #Downloads #Implementing #Logical #Modules #Spring #Boot #Applications #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *