Content ITV PRO
This is Itvedant Content department
Learning Outcome
5
4
3
2
1
Understand overall Spring Boot architecture and layered design
Learn APIs, REST services, and Spring annotations
Understand data formats like JSON and XML
Identify roles of controller, service, and repository layers
Explain client–server communication and request response cycle
Spring Boot Architecture illustrates how Spring Boot applications function with various components.
Handles requests • Calls service layer
Business logic • Processes data
Database interaction • Uses JPA
Stores and retrieves application data
Sends HTTP requests (Browser, Postman)
Core Components of Spring Boot Architecture
Auto Configuration
Automatically configures the application
No need for manual setup
Spring Boot Starter
Actuator
Core Components of Spring Boot Architecture
Embedded Server
Spring Data JPA
Spring Boot CLI
Used to run Spring Boot application using
Provides built-in server like: Tomcat ,Jetty
Client
Sends request (Browser / Postman)
Controller Layer
Service Layer
Interacts with database using JPA
Repository Layer
Stores or retrieves data
Database
Response Back
Response flows from Database to Repository to Service to Controller to Client.
Data Flow in Spring Boot Architecture
Data Flow in Spring Boot Architecture
The Client–Server Model is a communication between client and server using HTTP.
The Client (React, browser, Postman) sends a request.
The Spring Boot Server receives the request and processes it
The request is handled by:
Controller → receives request
Service → processes logic
Repository → interacts with database
The Server sends response back to the client in JSON format.
Client sends request
DispatcherServlet receives it
HandlerMapping finds the controller
Controller processes request
Service layer runs business logic
Repository gets data from DB
Response returned to client
Tomcat
Jetty
Undertow
Spring Boot includes embedded web servers that allow applications to run without external server setup.
These servers automatically start when the application runs.
In Spring Boot architecture, the Controller Layer is responsible for handling incoming HTTP requests from the client and sending back appropriate responses.
It acts as a bridge between the client (browser, mobile app, API consumer) and the backend business logic (Service Layer).
@RestController
Used to mark a class as a REST API controller.
@GetMapping
Handles HTTP GET requests.
@PostMapping
Handles HTTP POST requests.
The Service Layer in a Spring Boot application is responsible for implementing the core business logic of the system.
It acts as an intermediate layer between the Controller Layer and the Repository (Data Access) Layer.
In Spring Boot, the service layer is typically marked using the @Service annotation.
Purpose of @Service:
Indicates that the class contains business logic.
Enables dependency injection in controllers.
The Repository Layer in a Spring Boot application is responsible for handling all database-related operations.
It acts as an intermediate layer between the Service Layer and the database, allowing the application to interact with the data source in a structured way.
In Spring Boot, the repository layer commonly uses Spring Data JPA, which simplifies database interaction.
Spring Data JPA provides ready-made methods for common database operations such as: save(),findById(),findAll(),deleteById()
Web applications exchange data between client and server using structured formats.
The most common formats are JSON and XML.
These formats allow systems built with different technologies to communicate with each other efficiently.
Benefits:
Structured data representation
Platform independent communication
Easy data transfer over HTTP
JSON (JavaScript Object Notation) is a lightweight data format used widely in modern web applications.
Example:
{
"id": 101,
"name": "John",
"course": "Spring Boot"
}
Lightweight and faster
Easy to read and write
Easily parsed by most programming languages
Widely used in REST APIs
XML (Extensible Markup Language) is another format used for structured data exchange.XML represents data using tags, making it structured and easy to read.
<student>
<id>101</id>
<name>John</name>
<course>Spring Boot</course>
</student>
Example:
Structured and organized data format
Platform independent data exchange
Human readable and easy to understand
Self-descriptive using custom tags
Structure
Lightweight
Verbose
Speed
| Faster |
| Slower |
Readability
Easy
More complex
Usage
REST APIs
SOAP Services
Spring Boot handles content negotiation automatically using:
HTTP Headers – The client specifies the required format (e.g., application/json or application/xml).
Message Converters – Spring Boot uses built-in message converters to convert Java objects into the requested format like JSON or XML.
Content Negotiation is a mechanism that allows the server to return responses in different data formats, such as JSON or XML, based on what the client requests.
An API (Application Programming Interface) is a set of rules and protocols that allows different software applications to communicate and exchange data with each other.
Available Endpoints
The specific URLs where requests can be sent to access resources or services.
Request Methods
The type of operation to perform, such as GET, POST, PUT, or DELETE.
Web services enable communication between applications over the internet using standardized protocols.
They allow systems developed in different languages to interact with each other.
REST (Representational State Transfer)
Uses HTTP methods and commonly returns JSON data.
SOAP (Simple Object Access Protocol)
Uses XML messaging format and strict standards.
Data format
JSON / XML
XML
Protocol
HTTP
HTTP/SMPT
Speed
Faster
Slower
Flexibility
High
Strict
Used to retrieve, create, update, and delete data.
Specific URLs used to access resources in the API.
📄 JSON Data Format
Used to send and receive data between client and server.
🎮 Controller Classes
Handle incoming API requests and return responses.
⚙️ Service Layer
Contains the business logic and processes the data.
🗄️ Database Integration
Stores and retrieves application data from the database.
Annotations are special markers in Java that provide metadata to the Spring framework. They help configure the application automatically without writing complex configuration files.
Main class annotation
Creates REST APIs
Maps HTTP requests
Marks service classes
Handles database operations
Injects dependencies
@SpringBootApplication
@RestController
@RequestMapping
@Service
@Repository
@Autowired
Inversion of Control is a design principle where the control of object creation and dependency management is transferred from the programmer to the Spring framework.
Better scalability
Easier maintenance
Loose coupling
Dependency Injection (DI) is a design technique where the objects that a class needs (dependencies) are provided from outside instead of being created inside the class.
This helps in reducing tight coupling between classes and makes the application easier to maintain and test.
In Spring Boot, dependency injection is mainly performed using annotations such as
@Autowired
@Autowired
private StudentService service;
Example
Summary
5
4
3
2
1
Learn APIs, REST services, and Spring annotations
Understand data formats like JSON and XML
Identify roles of controller, service, and repository layers
Explain client–server communication and request response cycle
Understand overall Spring Boot architecture and layered design
Quiz
Which component in Spring MVC acts as the Front Controller?
A. Service
B. Repository
C. DispatcherServlet
D. ViewResolver
Which component in Spring MVC acts as the Front Controller?
A. Service
B. Repository
C. DispatcherServlet
D. ViewResolver
Quiz-Answer
By Content ITV