# spring-guides/gs-spring-boot architecture

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

- Interactive diagram: https://gitdiagram.com/spring-guides/gs-spring-boot
- Repository: https://github.com/spring-guides/gs-spring-boot

## Overview

1. This repository is a Spring Boot “getting started” sample, not a multi-service system. The core architecture is a single-process web application built twice: once in Java and once in Kotlin, with “initial” variants for the minimal starting point and “complete” variants for the finished example.

2. The application boundary is the Spring Boot runtime itself. Startup begins in `Application` (`Application.java` / `Application.kt`), which is the entry point and bootstraps the Spring application context. Spring Boot auto-configures the embedded web server, MVC stack, and supporting beans from the dependencies on the classpath.

3. The request-handling layer is a single controller: `HelloController`. It exposes one HTTP GET endpoint at `/` and returns a plain-text greeting. There is no separate service layer, persistence layer, or external data source in this sample; the request flows directly from the embedded server to the controller and back to the client.

4. The startup path also includes a `CommandLineRunner` bean in the complete application. On launch it inspects and prints the beans created by Spring Boot and the application itself. This is a diagnostic side effect, not part of the request path.

5. The complete versions add Spring Boot Actuator as a management subsystem. This introduces operational endpoints such as `/actuator` and `/actuator/health`, separate from the business endpoint `/`. These endpoints are provided by auto-configuration and are meant for runtime monitoring rather than user-facing behavior.

6. Testing is a first-class part of the complete example. There are two test styles: a mock web test using Spring MVC test support (`MockMvc`) and a full-stack integration test that starts the application on a random port. Together they validate both the controller behavior and the bootstrapped server path.

7. The repository is organized as parallel language tracks, each with the same architecture: `initial` and `complete` for Java, and `initial-kotlin` and `complete-kotlin` for Kotlin. This makes it easy to compare the minimum app with the finished version without changing the architectural shape.

8. Build and packaging are supported through both Gradle and Maven in the Java tracks, and Gradle in the Kotlin tracks. The project is set up to run as an executable JAR with Spring Boot’s plugins, rather than deploying as a traditional application server artifact.

9. Runtime dependencies that materially affect architecture are Spring Web MVC, embedded Tomcat, Spring Test, and Actuator. These choices define the application as a servlet-based HTTP service with in-process hosting and built-in management endpoints.

10. There is no database, message broker, cache, authentication layer, or external API integration in this repository. For an architecture diagram, the important elements are: client HTTP requests, embedded Spring Boot server, controller endpoint, optional actuator management endpoints, and the test harnesses that exercise both the controller and the full application context.

11. The `.github` workflows indicate CI and dependency automation around the sample, but they do not add runtime components. They support repository maintenance and verification, not the application architecture itself.

Main entry points: [`complete/src/main/java/com/example/springboot/HelloController.java`](https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/main/java/com/example/springboot/HelloController.java) (HelloController), [`complete-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt`](https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt) (HelloController), [`complete/src/main/java/com/example/springboot/Application.java`](https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/main/java/com/example/springboot/Application.java) (Application), [`complete-kotlin/src/main/kotlin/com/example/springboot/Application.kt`](https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/main/kotlin/com/example/springboot/Application.kt) (Application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_java_initial["Java initial"]
  node_runtime_java_initial["Boot runtime"]
  node_app_java_initial["Application<br/>app-entry<br/>[Application.java]"]
  node_controller_java_initial["HelloController"]
end

subgraph group_java_complete["Java complete"]
  node_runtime_java_complete["Boot runtime"]
  node_app_java_complete["Application<br/>app-entry<br/>[Application.java]"]
  node_controller_java_complete["HelloController"]
  node_diag_java_complete(("CommandLineRunner<br/>diagnostic"))
  node_actuator_java_complete["Actuator<br/>management"]
  node_mvc_test_java["MockMvc test<br/>test-mvc"]
  node_integration_test_java["Integration test<br/>test-integration"]
end

subgraph group_kotlin_initial["Kotlin initial"]
  node_runtime_kotlin_initial["Boot runtime"]
  node_app_kotlin_initial["Application<br/>app-entry<br/>[Application.kt]"]
  node_controller_kotlin_initial["HelloController<br/>[HelloController.kt]"]
end

subgraph group_kotlin_complete["Kotlin complete"]
  node_runtime_kotlin_complete["Boot runtime"]
  node_app_kotlin_complete["Application<br/>app-entry<br/>[Application.kt]"]
  node_controller_kotlin_complete["HelloController<br/>[HelloController.kt]"]
  node_diag_kotlin_complete(("CommandLineRunner<br/>diagnostic"))
  node_actuator_kotlin_complete["Actuator<br/>management"]
  node_mvc_test_kotlin["MockMvc test<br/>test-mvc"]
  node_integration_test_kotlin["Integration test<br/>test-integration"]
end

node_client(("HTTP client"))

node_client -->|"HTTP request"| node_runtime_java_initial
node_runtime_java_initial -->|"dispatch"| node_controller_java_initial
node_controller_java_initial -->|"response"| node_client
node_app_java_initial -->|"bootstraps"| node_runtime_java_initial
node_client -->|"HTTP request"| node_runtime_java_complete
node_runtime_java_complete -->|"dispatch"| node_controller_java_complete
node_controller_java_complete -->|"response"| node_client
node_app_java_complete -->|"bootstraps"| node_runtime_java_complete
node_app_java_complete -->|"registers"| node_diag_java_complete
node_diag_java_complete -->|"observes"| node_runtime_java_complete
node_app_java_complete -->|"enables"| node_actuator_java_complete
node_mvc_test_java -->|"verifies"| node_controller_java_complete
node_integration_test_java -->|"starts"| node_runtime_java_complete
node_integration_test_java -->|"exercises"| node_controller_java_complete
node_client -->|"HTTP request"| node_runtime_kotlin_initial
node_runtime_kotlin_initial -->|"dispatch"| node_controller_kotlin_initial
node_controller_kotlin_initial -->|"response"| node_client
node_app_kotlin_initial -->|"bootstraps"| node_runtime_kotlin_initial
node_client -->|"HTTP request"| node_runtime_kotlin_complete
node_runtime_kotlin_complete -->|"dispatch"| node_controller_kotlin_complete
node_controller_kotlin_complete -->|"response"| node_client
node_app_kotlin_complete -->|"bootstraps"| node_runtime_kotlin_complete
node_app_kotlin_complete -->|"registers"| node_diag_kotlin_complete
node_diag_kotlin_complete -->|"observes"| node_runtime_kotlin_complete
node_app_kotlin_complete -->|"enables"| node_actuator_kotlin_complete
node_mvc_test_kotlin -->|"verifies"| node_controller_kotlin_complete
node_integration_test_kotlin -->|"starts"| node_runtime_kotlin_complete
node_integration_test_kotlin -->|"exercises"| node_controller_kotlin_complete

click node_app_java_initial "https://github.com/spring-guides/gs-spring-boot/blob/main/initial/src/main/java/com/example/springboot/Application.java"
click node_controller_java_initial "https://github.com/spring-guides/gs-spring-boot/blob/main/initial/src/main/java/com/example/springboot/HelloController.java"
click node_app_java_complete "https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/main/java/com/example/springboot/Application.java"
click node_controller_java_complete "https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/main/java/com/example/springboot/HelloController.java"
click node_mvc_test_java "https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/test/java/com/example/springboot/HelloControllerTest.java"
click node_integration_test_java "https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/test/java/com/example/springboot/HelloControllerIntegrationTest.java"
click node_app_kotlin_initial "https://github.com/spring-guides/gs-spring-boot/blob/main/initial-kotlin/src/main/kotlin/com/example/springboot/Application.kt"
click node_controller_kotlin_initial "https://github.com/spring-guides/gs-spring-boot/blob/main/initial-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt"
click node_app_kotlin_complete "https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/main/kotlin/com/example/springboot/Application.kt"
click node_controller_kotlin_complete "https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt"
click node_mvc_test_kotlin "https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/test/kotlin/com/example/springboot/HelloControllerTest.kt"
click node_integration_test_kotlin "https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/test/kotlin/com/example/springboot/HelloControllerIntegrationTest.kt"

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_runtime_java_initial,node_app_java_initial,node_controller_java_initial toneBlue
class node_runtime_java_complete,node_app_java_complete,node_controller_java_complete,node_diag_java_complete,node_actuator_java_complete,node_mvc_test_java,node_integration_test_java toneAmber
class node_runtime_kotlin_initial,node_app_kotlin_initial,node_controller_kotlin_initial toneMint
class node_runtime_kotlin_complete,node_app_kotlin_complete,node_controller_kotlin_complete,node_diag_kotlin_complete,node_actuator_kotlin_complete,node_mvc_test_kotlin,node_integration_test_kotlin toneRose
class node_client toneNeutral
```

## Components

### Java initial

Minimal Java Spring Boot sample.

- **Boot runtime**: runtime · Embedded Spring Boot web runtime and MVC stack.
- [Application](https://github.com/spring-guides/gs-spring-boot/blob/main/initial/src/main/java/com/example/springboot/Application.java): app-entry · Java entry point that bootstraps Spring. · `initial/src/main/java/com/example/springboot/Application.java`
- [HelloController](https://github.com/spring-guides/gs-spring-boot/blob/main/initial/src/main/java/com/example/springboot/HelloController.java): controller · HTTP GET endpoint at / returning plain text. · `initial/src/main/java/com/example/springboot/HelloController.java`

### Java complete

Finished Java sample with diagnostics, actuator, and tests.

- **Boot runtime**: runtime · Embedded Spring Boot web runtime and MVC stack.
- [Application](https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/main/java/com/example/springboot/Application.java): app-entry · Java entry point that bootstraps Spring. · `complete/src/main/java/com/example/springboot/Application.java`
- [HelloController](https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/main/java/com/example/springboot/HelloController.java): controller · HTTP GET endpoint at / returning plain text. · `complete/src/main/java/com/example/springboot/HelloController.java`
- **CommandLineRunner**: diagnostic · Startup hook that prints the created beans.
- **Actuator**: management · Operational endpoints such as /actuator and /actuator/health.
- [MockMvc test](https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/test/java/com/example/springboot/HelloControllerTest.java): test-mvc · Verifies controller behavior through Spring MVC test support. · `complete/src/test/java/com/example/springboot/HelloControllerTest.java`
- [Integration test](https://github.com/spring-guides/gs-spring-boot/blob/main/complete/src/test/java/com/example/springboot/HelloControllerIntegrationTest.java): test-integration · Starts the app on a random port and exercises the full stack. · `complete/src/test/java/com/example/springboot/HelloControllerIntegrationTest.java`

### Kotlin initial

Minimal Kotlin Spring Boot sample.

- **Boot runtime**: runtime · Embedded Spring Boot web runtime and MVC stack.
- [Application](https://github.com/spring-guides/gs-spring-boot/blob/main/initial-kotlin/src/main/kotlin/com/example/springboot/Application.kt): app-entry · Kotlin entry point that bootstraps Spring. · `initial-kotlin/src/main/kotlin/com/example/springboot/Application.kt`
- [HelloController](https://github.com/spring-guides/gs-spring-boot/blob/main/initial-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt): controller · HTTP GET endpoint at / returning plain text. · `initial-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt`

### Kotlin complete

Finished Kotlin sample with diagnostics, actuator, and tests.

- **Boot runtime**: runtime · Embedded Spring Boot web runtime and MVC stack.
- [Application](https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/main/kotlin/com/example/springboot/Application.kt): app-entry · Kotlin entry point that bootstraps Spring. · `complete-kotlin/src/main/kotlin/com/example/springboot/Application.kt`
- [HelloController](https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt): controller · HTTP GET endpoint at / returning plain text. · `complete-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt`
- **CommandLineRunner**: diagnostic · Startup hook that prints the created beans.
- **Actuator**: management · Operational endpoints such as /actuator and /actuator/health.
- [MockMvc test](https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/test/kotlin/com/example/springboot/HelloControllerTest.kt): test-mvc · Verifies controller behavior through Spring MVC test support. · `complete-kotlin/src/test/kotlin/com/example/springboot/HelloControllerTest.kt`
- [Integration test](https://github.com/spring-guides/gs-spring-boot/blob/main/complete-kotlin/src/test/kotlin/com/example/springboot/HelloControllerIntegrationTest.kt): test-integration · Starts the app on a random port and exercises the full stack. · `complete-kotlin/src/test/kotlin/com/example/springboot/HelloControllerIntegrationTest.kt`

### Other components

- **HTTP client**: client · Sends requests to the sample applications.

## Connections

- HTTP client → Boot runtime: HTTP request · Client calls the embedded server.
- Boot runtime → HelloController: dispatch · Spring MVC routes / to the controller.
- HelloController → HTTP client: response · Plain-text greeting returns to the caller.
- Application → Boot runtime: bootstraps · Application starts the Spring context and embedded server.
- HTTP client → Boot runtime: HTTP request · Client calls the embedded server.
- Boot runtime → HelloController: dispatch · Spring MVC routes / to the controller.
- HelloController → HTTP client: response · Plain-text greeting returns to the caller.
- Application → Boot runtime: bootstraps · Application starts the Spring context and embedded server.
- Application → CommandLineRunner: registers · Complete app adds a startup diagnostic bean.
- CommandLineRunner → Boot runtime: observes · Prints beans created by Spring Boot and the application.
- Application → Actuator: enables · Actuator auto-configuration adds management endpoints.
- MockMvc test → HelloController: verifies · MockMvc exercises controller behavior without a real server.
- Integration test → Boot runtime: starts · Integration test boots the application on a random port.
- Integration test → HelloController: exercises · Full-stack test reaches the controller through HTTP.
- HTTP client → Boot runtime: HTTP request · Client calls the embedded server.
- Boot runtime → HelloController: dispatch · Spring MVC routes / to the controller.
- HelloController → HTTP client: response · Plain-text greeting returns to the caller.
- Application → Boot runtime: bootstraps · Application starts the Spring context and embedded server.
- HTTP client → Boot runtime: HTTP request · Client calls the embedded server.
- Boot runtime → HelloController: dispatch · Spring MVC routes / to the controller.
- HelloController → HTTP client: response · Plain-text greeting returns to the caller.
- Application → Boot runtime: bootstraps · Application starts the Spring context and embedded server.
- Application → CommandLineRunner: registers · Complete app adds a startup diagnostic bean.
- CommandLineRunner → Boot runtime: observes · Prints beans created by Spring Boot and the application.
- Application → Actuator: enables · Actuator auto-configuration adds management endpoints.
- MockMvc test → HelloController: verifies · MockMvc exercises controller behavior without a real server.
- Integration test → Boot runtime: starts · Integration test boots the application on a random port.
- Integration test → HelloController: exercises · Full-stack test reaches the controller through HTTP.
