How spring-guides/gs-spring-boot works
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: HelloController.java HelloController · HelloController.kt HelloController · Application.java Application · Application.kt Application
Components 21
Java initial
Minimal Java Spring Boot sample.
- Boot runtime · Embedded Spring Boot web runtime and MVC stack.
- Application · Java entry point that bootstraps Spring.
initial/src/main/java/com/example/springboot/Application.java - HelloController · 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 · Embedded Spring Boot web runtime and MVC stack.
- Application · Java entry point that bootstraps Spring.
complete/src/main/java/com/example/springboot/Application.java - HelloController · HTTP GET endpoint at / returning plain text.
complete/src/main/java/com/example/springboot/HelloController.java - CommandLineRunner · Startup hook that prints the created beans.
- Actuator · Operational endpoints such as /actuator and /actuator/health.
- MockMvc test · Verifies controller behavior through Spring MVC test support.
complete/src/test/java/com/example/springboot/HelloControllerTest.java - Integration test · 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 · Embedded Spring Boot web runtime and MVC stack.
- Application · Kotlin entry point that bootstraps Spring.
initial-kotlin/src/main/kotlin/com/example/springboot/Application.kt - HelloController · 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 · Embedded Spring Boot web runtime and MVC stack.
- Application · Kotlin entry point that bootstraps Spring.
complete-kotlin/src/main/kotlin/com/example/springboot/Application.kt - HelloController · HTTP GET endpoint at / returning plain text.
complete-kotlin/src/main/kotlin/com/example/springboot/HelloController.kt - CommandLineRunner · Startup hook that prints the created beans.
- Actuator · Operational endpoints such as /actuator and /actuator/health.
- MockMvc test · Verifies controller behavior through Spring MVC test support.
complete-kotlin/src/test/kotlin/com/example/springboot/HelloControllerTest.kt - Integration test · 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 · Sends requests to the sample applications.
Connections 28
- 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.