Open In App

What is Spring Modulith?

In this article, we will embark on a journey to explore Spring Modulith and understand how it revolutionizes the way we design and develop modern software applications.

What is a modular monolith application?

A modular monolith application in Spring Boot is when a traditionally monolithic application (with all code in one project/module) is broken up into distinct modules while still maintaining a single codebase and deployment.

Spring Modulith

Benefits

Why is Spring Modulith important?

Key Concepts of Spring Modulith

Application modules:

Package arrangement:

Arrangement

Module encapsulation:

Module interaction:

Get started with Spring Modulith, you can follow these steps:

  1. Add the Spring Modulith dependency to your project.
  2. Create a Java package arrangement that puts business modules as direct sub-packages of the application’s main package.
  3. Create an ApplicationModules model, run verifications, and create documentation snippets.
  4. Run integration tests for individual application modules.

Dependency

Maven:

<!-- https://mvnrepository.com/artifact/org.springframework.modulith/spring-modulith-bom -->
<dependency>
<groupId>org.springframework.modulith</groupId>
<artifactId>spring-modulith-bom</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>

Gradle:

// https://mavenlibs.com/maven/pom/org.springframework.experimental/spring-modulith-bom
implementation group: 'org.springframework.experimental', name: 'spring-modulith-bom', version: '0.6.0'

Case studies of organizations using Spring Modulith

Article Tags :