Marcus Biel.

Client project · Automotive

Giving a Java monolith clear module boundaries

An automotive team was considering splitting a long-lived Java application into microservices. Its parts were so tightly coupled that one change often affected several of them. I proposed drawing clear business boundaries inside the existing application first.

I joined the team to modularize the Java 8 application and help upgrade its platform.

Architecture and application code

Less code, with a clear home for each business rule

Java platform

8 → 21Spring Boot 2 to Spring Boot 3.3

Lines in the monolith, before and after

100,000 → 40,000Approximate counts, a reduction of about 60%

How we chose the boundaries

We used domain-driven design to give each module a business responsibility. The modules still shipped together. As we upgraded Hibernate from 5 to 6 and Spring Boot from 2 to 3.3, we introduced end-to-end tests with REST Assured to check behaviour through the application’s REST API.

How the modules connect

We used hexagonal architecture to keep business logic at the core. The database, user interface and external systems connect to it through ports and adapters. In the process I reduced the monolith from roughly 100,000 lines to 40,000.

My hexagonal architecture lesson diagrams the boundaries between business rules and infrastructure.

Build infrastructure

Cutting Maven build time from 30 minutes to 15 seconds

The application shipped as a whole, but the build was spread across several Maven projects with their own configuration files. Some of their dependencies were circular. There were about 30 developers on the project. With a half-hour wait each time, it was tempting to batch several changes before building again.

A colleague and I combined the artifacts, broke the cycles and reduced the configuration to a single Maven POM.

Developers could now see in 15 seconds whether their changes built successfully.

What would you like to change in your Java application?

A few lines about your Java version, the size of the application and your timeframe are enough to start. The form already has Java modernization selected. I’ll look at the options with you and bring in specialists if the work calls for them.

Prefer to talk first? Call +49 171 1151013 or message me on LinkedIn.

Discuss your Java project