Git Product home page Git Product logo

spring-modulith's Introduction

Spring Modulith Revved up by Gradle Enterprise

Spring Modulith allows developers to build well-structured Spring Boot applications and guides developers in finding and working with application modules driven by the domain. It supports the verification of such modular arrangements, integration testing individual modules, observing the application’s behavior on the module level and creating documentation snippets based on the arrangement created.

Quickstart

  1. Create a Spring Boot application on https://start.spring.io

  2. Add Spring Modulith to your application by adding this to your pom.xml:

    <!-- The Maven repository to pull the dependencies from -->
    <repositories>
      <repository>
        <id>spring-snapshots</id>
        <url>https://repo.spring.io/snapshot</url>
      </repository>
    </repositories>
    
    <!-- Include the BOM for simplified version management -->
    <dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.springframework.modulith</groupId>
          <artifactId>spring-modulith-bom</artifactId>
          <version>1.0.0-SNAPSHOT</version>
          <scope>import</scope>
          <type>pom</type>
        </dependency>
      </dependencies>
    </dependencyManagement>
    
    <dependencies>
    
      <!-- The test dependency to pull in verification APIs -->
    
      <dependency>
        <groupId>org.springframework.modulith</groupId>
        <artifactId>spring-modulith-starter-test</artifactId>
        <scope>test</scope>
      </dependency>
    
    </dependencies>
  3. Create a Java package arrangement that puts business modules as direct sub-packages of the application’s main package.

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

    2. Application module packages

  4. Create an ApplicationModules model, run verifications and create documentation snippets.

    class ApplicationTests {
    
      @Test
      void writeDocumentationSnippets() {
    
        var modules = ApplicationModules.of(Application.class).verify(); (1)
    
        new Documenter(modules) (2)
          .writeModulesAsPlantUml()
          .writeIndividualModulesAsPlantUml();
      }
    }
    1. Creates application module model and verifies its structure.

    2. Renders Asciidoctor snippets (component diagrams, application module canvas) to target/modulith-docs.

  5. Run integration tests for individual application modules.

    □ Example
    └─ □ src/test/java
       └─ □ example.order
          └─ OrderModuleIntegrationTests.java
    @ApplicationModuleTests
    class OrderModuleIntegrationTests {
    
      @Test
      void someTestMethod() { … }
    }

Reference documentation

Find the reference documentation here.

Contributing

Pull requests are welcome. Note, that we expect everyone to follow the code of conduct.

License

Spring Modulith is Open Source software released under the Apache 2.0 license.

spring-modulith's People

Contributors

odrotbohm avatar erichaagdev avatar mweirauch avatar rwinch avatar yossisp avatar benjaminknauer avatar meistermeier avatar jochenwierum avatar khmarbaise avatar ksilz avatar maciejwalkowiak avatar mouaadaassou avatar lilbaek avatar simonverhoeven avatar tobhai avatar thombergs avatar jwalter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.