Tutorials/Spring Boot/Spring Boot
Lesson

Architecture

Spring Boot /Spring Boot

Spring Boot Architecture

1. Introduction

Spring Boot is built on top of Spring Framework.

It helps to:

  • Reduce boilerplate code

  • Provide auto-configuration

  • Run applications with embedded servers

Spring Boot is used to build:

  • Standalone applications

  • Scalable systems

  • Production-ready applications


2. Spring Boot Architecture Layers

Spring Boot architecture is divided into four layers:

  1. Presentation Layer

  2. Business Layer

  3. Persistence Layer

  4. Database Layer


3. Presentation Layer

This is the entry point of the application.

Responsibilities

  • Handles HTTP requests (GET, POST, PUT, DELETE)

  • Exposes REST APIs

  • Validates request data

  • Converts Java objects to JSON

  • Sends response to client

  • Calls Service layer

Common Annotations

  • @RestController / @Controller

  • @RequestMapping

  • @GetMapping, @PostMapping

  • @RequestBody

  • @PathVariable


4. Business Layer (Service Layer)

This layer contains business logic.

Responsibilities

  • Implements business rules

  • Processes data

  • Handles authentication and authorization

  • Manages transactions

  • Calls repository layer

Common Annotations

  • @Service

  • @Transactional


5. Persistence Layer (Repository Layer)

This layer handles database operations.

Responsibilities

  • Performs CRUD operations

  • Maps Java objects to database tables

  • Interacts with database

Technologies

  • Spring Data JPA

  • Hibernate

  • R2DBC

Common Annotations

  • @Repository

  • JpaRepository

  • CrudRepository

  • @Entity

  • @Id

  • @Table


6. Database Layer

This layer stores actual data.

Types of Databases

  • Relational databases

    • MySQL

    • PostgreSQL

    • Oracle

    • SQL Server

  • NoSQL databases

    • MongoDB

    • Cassandra

    • Firebase


7. Spring Boot Flow

Step 1

Client sends request

Step 2

Controller receives request

Step 3

Service layer processes logic

Step 4

Repository interacts with database

Step 5

Response is returned as JSON


8. Spring Boot Actuator

Spring Boot provides Actuator for monitoring.

Features

  • Health check

  • Application metrics

  • Environment details

  • Memory and thread monitoring

  • Custom endpoints


9. Conclusion

  • Spring Boot architecture is layered and clean

  • Each layer has a specific responsibility

  • Helps build scalable and maintainable applications

Architecture | Spring Boot | Softcrayons Tech Solutions