Backend Development 16 min read

Designing a Modular Spring Boot Backend: Principles, Project Structure, and Maven Configuration

This article explains how to design a clean, maintainable Spring Boot backend by applying core software principles, organizing modules such as core, common, business, and admin, and providing complete Maven pom examples to illustrate a modular multi‑module project layout.

Top Architect
Top Architect
Top Architect
Designing a Modular Spring Boot Backend: Principles, Project Structure, and Maven Configuration

Recently I decided to apply years of learning to build a full‑stack backend management system called XiaoLe using Spring Boot, and I documented the entire design process, from high‑level architecture to concrete Maven configurations.

Key design principles include:

Single Responsibility Principle : each module focuses on a single, well‑defined responsibility.

High Cohesion : related classes are grouped together to improve understandability.

Low Coupling : dependencies between modules are minimized.

Reusability : common utilities are extracted to a common module for reuse across the project.

Clear Boundaries and Interfaces : module APIs are explicit, making integration easier.

Moderate Modularity : avoid over‑fragmentation while keeping related components together.

Layered Architecture : separate controller, service, and data‑access layers.

Dependency Inversion : depend on abstractions rather than concrete implementations.

Testability : design modules to be easily unit‑tested.

Adaptability for Future Extension : structure the code so new features can be added with minimal impact.

The overall project layout (simplified) looks like this:

Each module has a specific role:

core : provides common configuration, interceptors, and global exception handling.

common : contains utility classes and shared resources.

business : implements the actual business logic and data access.

gen‑code : a code‑generation helper based on Velocity.

tripartite : integrates third‑party services.

admin : the management UI and related backend services.

Below is the pom.xml for the le‑core module, showing essential dependencies such as Spring Boot Web, MyBatis, and MySQL:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.xiaole</groupId>
        <artifactId>XiaoLe</artifactId>
        <version>1.0.0</version>
    </parent>
    <groupId>com.le</groupId>
    <artifactId>le-core</artifactId>
    <name>le-core</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.le</groupId>
            <artifactId>le-business</artifactId>
        </dependency>
    </dependencies>
</project>

The parent pom.xml uses the import scope to manage versions centrally, allowing all modules to share the same Spring Boot, Velocity, and MyBatis versions while keeping the individual module pom files concise.

Using import in Maven lets you bring the dependencyManagement section of another pom into the current project, making version control across modules easier and ensuring consistent library versions throughout the multi‑module build.

Overall, the article provides a practical reference for engineers who want to build a clean, modular backend with Spring Boot, illustrating both architectural thinking and concrete Maven setup.

Javabackend architectureMavenSpring BootModular Design
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.