# deepaksrivastav/spring-boot-multimodule architecture

> Architecture diagram of the GitHub repository deepaksrivastav/spring-boot-multimodule, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deepaksrivastav/spring-boot-multimodule
- Repository: https://github.com/deepaksrivastav/spring-boot-multimodule

## Overview

#### Purpose and Runtime

A Spring Boot multi-module proof of concept demonstrating layered Java application packaging. The `application` module is the runnable web application, launched via its Spring Boot main class and served by embedded Tomcat.

Entry points:
- `application/src/main/java/sample/multimodule/SampleWebJspApplication.java`
- `application/src/main/java/sample/multimodule/web/WelcomeController.java`

#### Maven Module Composition

The root Maven aggregator coordinates six modules and shared dependency management:
- `pom.xml`
- `application/pom.xml`
- `service-impl/pom.xml`

Dependencies follow a strict layer direction: application → service implementation → repository/service API → model. The model module is dependency-free and forms the shared domain boundary.

#### Web and Presentation Boundary

The application module owns HTTP handling, application properties, and server-rendered presentation. `WelcomeController` receives browser requests and delegates account lookup rather than accessing persistence directly.

Relevant paths:
- `application/src/main/java/sample/multimodule/web/WelcomeController.java`
- `application/src/main/resources/templates/welcome/show.html`
- `application/src/main/resources/application.properties`

The presentation response is an HTML template populated with account information.

#### Service Contract and Business Layer

`service-api` defines the stable account-service interface and domain-specific missing-account failure independently of its implementation:
- `service-api/src/main/java/sample/multimodule/service/api/AccountService.java`
- `service-api/src/main/java/sample/multimodule/service/api/AccountNotFoundException.java`

`service-impl` supplies the Spring-managed implementation, bridging the service contract to the repository:
- `service-impl/src/main/java/sample/multimodule/service/impl/AccountServiceImpl.java`
- `service-impl/pom.xml`

This split allows callers such as web code to depend on service abstractions while persistence remains internal to implementation wiring.

#### Persistence Boundary

The repository module encapsulates account data access and depends on the domain model:
- `repository/src/main/java/sample/multimodule/repository/AccountRepository.java`
- `repository/pom.xml`

Service implementation is the intended consumer of this repository. No separate database or external infrastructure is identified in the supplied repository structure.

#### Shared Domain Model

The model module contains cross-layer entities/value objects, specifically the account domain object:
- `model/src/main/java/sample/multimodule/domain/entity/Account.java`
- `model/pom.xml`

`Account` is shared by repository, service API, service implementation, and application-facing flows, making it the primary data carrier.

#### Primary Request Flow

A browser request reaches embedded Tomcat and Spring MVC in the application module. `WelcomeController` invokes `AccountService`; its implementation queries `AccountRepository`; the resulting `Account` returns through the service boundary to the controller, which renders the welcome HTML view. Missing-account behavior is represented by `AccountNotFoundException`.

The executable distribution is built from the root and run from `application`; runtime configuration remains local to the application module.

Main entry points: [`service-impl/src/main/java/sample/multimodule/service/impl/AccountServiceImpl.java`](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/service-impl/src/main/java/sample/multimodule/service/impl/AccountServiceImpl.java) (Account Service Implementation), [`service-api/src/main/java/sample/multimodule/service/api/AccountService.java`](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/service-api/src/main/java/sample/multimodule/service/api/AccountService.java) (Account Service), [`application/pom.xml`](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/pom.xml) (Application Module), [`application/src/main/java/sample/multimodule/web/WelcomeController.java`](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/java/sample/multimodule/web/WelcomeController.java) (Welcome Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Maven Build"]
  node_root["Root Aggregator<br/>Maven aggregator<br/>[pom.xml]"]
end

subgraph group_app["Runnable Application"]
  node_application["Application Module<br/>Spring Boot module<br/>[pom.xml]"]
  node_boot(("Boot Main Class<br/>Spring Boot entry point"))
  node_tomcat{{"Embedded Tomcat / Spring MVC<br/>web runtime"}}
  node_controller["Welcome Controller<br/>MVC controller"]
  node_view["Welcome HTML View<br/>server-rendered template<br/>[show.html]"]
  node_config["Application Properties<br/>runtime configuration"]
end

subgraph group_service["Service Layer"]
  node_service_api["Account Service<br/>service contract"]
  node_not_found["Account Not Found<br/>domain failure"]
  node_service_impl["Account Service Implementation<br/>Spring service"]
end

subgraph group_data["Domain &amp; Persistence"]
  node_repository["Account Repository<br/>persistence boundary"]
  node_account["Account<br/>domain entity<br/>[Account.java]"]
end

node_root -->|"aggregates"| node_application
node_application -->|"launches"| node_boot
node_boot -->|"starts"| node_tomcat
node_config -.->|"configures"| node_boot
node_tomcat -->|"routes requests to"| node_controller
node_controller -->|"invokes"| node_service_api
node_service_impl -->|"implements"| node_service_api
node_service_impl -->|"queries"| node_repository
node_repository -->|"loads"| node_account
node_service_api -->|"returns"| node_account
node_service_api -->|"signals"| node_not_found
node_controller -->|"renders with Account"| node_view
node_application -.->|"depends on"| node_service_impl
node_service_impl -.->|"module dependency"| node_repository

click node_root "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/pom.xml"
click node_application "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/pom.xml"
click node_boot "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/java/sample/multimodule/SampleWebJspApplication.java"
click node_controller "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/java/sample/multimodule/web/WelcomeController.java"
click node_view "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/resources/templates/welcome/show.html"
click node_config "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/resources/application.properties"
click node_service_api "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/service-api/src/main/java/sample/multimodule/service/api/AccountService.java"
click node_not_found "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/service-api/src/main/java/sample/multimodule/service/api/AccountNotFoundException.java"
click node_service_impl "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/service-impl/src/main/java/sample/multimodule/service/impl/AccountServiceImpl.java"
click node_repository "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/repository/src/main/java/sample/multimodule/repository/AccountRepository.java"
click node_account "https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/model/src/main/java/sample/multimodule/domain/entity/Account.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_root toneBlue
class node_application,node_boot,node_tomcat,node_controller,node_view,node_config toneAmber
class node_service_api,node_not_found,node_service_impl toneMint
class node_repository,node_account toneRose
```

## Components

### Maven Build

- [Root Aggregator](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/pom.xml): Maven aggregator · Coordinates the six modules and shared dependency management. · `pom.xml`

### Runnable Application

- [Application Module](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/pom.xml): Spring Boot module · Runnable web application and composition boundary. · `application/pom.xml`
- [Boot Main Class](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/java/sample/multimodule/SampleWebJspApplication.java): Spring Boot entry point · `application/src/main/java/sample/multimodule/SampleWebJspApplication.java`
- **Embedded Tomcat / Spring MVC**: web runtime
- [Welcome Controller](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/java/sample/multimodule/web/WelcomeController.java): MVC controller · `application/src/main/java/sample/multimodule/web/WelcomeController.java`
- [Welcome HTML View](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/resources/templates/welcome/show.html): server-rendered template · `application/src/main/resources/templates/welcome/show.html`
- [Application Properties](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/application/src/main/resources/application.properties): runtime configuration · `application/src/main/resources/application.properties`

### Service Layer

- [Account Service](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/service-api/src/main/java/sample/multimodule/service/api/AccountService.java): service contract · Stable account lookup abstraction used by callers. · `service-api/src/main/java/sample/multimodule/service/api/AccountService.java`
- [Account Not Found](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/service-api/src/main/java/sample/multimodule/service/api/AccountNotFoundException.java): domain failure · `service-api/src/main/java/sample/multimodule/service/api/AccountNotFoundException.java`
- [Account Service Implementation](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/service-impl/src/main/java/sample/multimodule/service/impl/AccountServiceImpl.java): Spring service · Bridges the service contract to repository access. · `service-impl/src/main/java/sample/multimodule/service/impl/AccountServiceImpl.java`

### Domain & Persistence

- [Account Repository](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/repository/src/main/java/sample/multimodule/repository/AccountRepository.java): persistence boundary · Encapsulates account data access. · `repository/src/main/java/sample/multimodule/repository/AccountRepository.java`
- [Account](https://github.com/deepaksrivastav/spring-boot-multimodule/blob/master/model/src/main/java/sample/multimodule/domain/entity/Account.java): domain entity · Shared cross-layer account data carrier. · `model/src/main/java/sample/multimodule/domain/entity/Account.java`

## Connections

- Root Aggregator → Application Module: aggregates
- Application Module → Boot Main Class: launches
- Boot Main Class → Embedded Tomcat / Spring MVC: starts
- Application Properties → Boot Main Class: configures
- Embedded Tomcat / Spring MVC → Welcome Controller: routes requests to
- Welcome Controller → Account Service: invokes
- Account Service Implementation → Account Service: implements
- Account Service Implementation → Account Repository: queries
- Account Repository → Account: loads
- Account Service → Account: returns
- Account Service → Account Not Found: signals
- Welcome Controller → Welcome HTML View: renders with Account
- Application Module → Account Service Implementation: depends on
- Account Service Implementation → Account Repository: module dependency
