Spring Modulith 2.0 GA — article by Chamod Maduwantha, Software Engineer at ArkStatic

Spring Modulith 2.0 GA

We have an important update for everyone who builds apps with Spring: Spring Modulith 2.0 is out now! We also got small update fixes for older versions (1.4.5 and 1.3.11). This new release is a big deal. It helps us keep our application code cleaner, better organized, and more stable.

What’s New in Spring Modulith 2.0? 

Version 2.0 is built on the newest Spring platform, meaning it works with the latest Spring Boot 4 and Spring Framework 7. This keeps our tools up-to-date. 

Core Feature Enhancements 

Feature Description for Documentation
Overhaul Event Publication Lifecycle (New Persistence Support) This is the most significant feature upgrade, focusing on reliable messaging (ensuring a domain event is successfully recorded before it is externalized). The overhaul introduces native support for several data stores to manage the event publication registry, making reliable event publication simpler and database-agnostic.New Native Support Includes:JPA (Jakarta Persistence API)- JDBC (Java Database Connectivity)- MongoDBNeo4j
Support to Verify Application Module Structure on Startup Spring Modulith’s core mission is to enforce architectural boundaries. Previously, structure verification primarily happened during integration tests. Now, developers can enable strict runtime verification using a property (e.g., spring.modulith.runtime.verification-enabled). If any module dependency rules are violated—for instance, if Module A illegally accesses internal components of Module B—the application will fail fast upon startup, catching architectural regressions immediately.
Support for Application-Module-Specific Flyway Migrations This feature streamlines the management of database schema evolution in a modular monolith. It allows developers to define Flyway migration scripts (SQL files) that are logically scoped to a specific application module. This reinforces encapsulation, ensuring that a module’s persistent data structures are managed and evolved independently by that module, preventing accidental dependencies on shared schema parts.
Allow Serialized Execution of Event Externalization When a published domain event needs to be sent to an external message broker (like Kafka or RabbitMQ), order preservation is often critical. This feature ensures that the externalization process (transferring the event from the application’s reliable persistence store to the broker) happens in a serialized manner, guaranteeing that events arrive at the broker in the exact sequence they were published within the application.

Technical and Platform Improvements

Feature Description for Documentation
Support for Jackson 3 in Event Serialization Jackson is the primary JSON processing library in the Spring ecosystem. This upgrade ensures that event serialization (the process of converting domain events into a transferable format like JSON) is fully compatible with and leverages the features and performance improvements of the Jackson 3.x generation.
Migrate Nullness Verification to jSpecify This is part of a broader, ecosystem-wide effort by the Spring team. Migrating to jSpecify—the standardized annotations for nullness—improves the robustness of the codebase. It helps ensure consistent, compile-time null safety checks across the Spring Modulith framework and improves compatibility with modern IDEs and static analysis tools.
Extract Module Description from a Module’s package-info.java Javadoc This introduces a conventional, clean way to document the purpose of an application module. By reading the Javadoc from the module’s package-info.java file, Spring Modulith’s Documenter tool can automatically generate rich, descriptive architectural documentation without requiring separate configuration files.
Propagate Named Interface Assignments of Types to Return and Parameter Types of Methods Declared This is a technical refinement for the architectural analysis and documentation tools. It ensures that when Spring Modulith analyzes a module’s public interface, the types used for method parameters and return values are correctly recognized as part of that module’s public API. This leads to more accurate dependency checks and better-generated documentation.
Remove Deprecated @ApplicationEventListener Annotation This is a cleanup measure. The deprecated annotation has been removed to simplify the API and standardize event listening around the regular, modern Spring event mechanism (typically the standard @EventListener annotation).

For Existing Projects

For those of us still using versions 1.4 or 1.3, the team also released bug fixes (1.4.5 and 1.3.11). These small updates keep those older apps stable. 

What We Should Do Next 

    • New Apps: Start using Spring Modulith 2.0 GA for all new modular projects right away.

    • Old Apps: Our teams should start planning to move existing Modulith projects to the 2.0 version soon to get all the structure and stability benefits.

The full details are on the Spring blog if you need them: Spring Modulith 2.0 GA, 1.4.5, and 1.3.11 released

 

Author:

Chamod Maduwantha

Share Now:

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments