Notes
Notes
od
Introduction to Spring &
er
SpringBoot
Ar
m
1. The Starting Point: How Web Applications
y
Communicate
Before understanding Spring, Spring Boot, Servlet, or any backend framework, we
first need to understand one basic question:
How does a user sitting on one machine communicate with code running on
another machine?
This is the foundation of web development.
When you open a browser and type:
[Link]
2. Client–Server Architecture
What is a Client?
A client is the side that asks for something.
Examples of clients:
Ar
Postman
Frontend React app
Android app
m
iOS app
y
When you open a website, your browser becomes the client.
It sends a request like:
“Hey server, give me this webpage.”
What is a Server?
A server is the side that receives requests, processes them, and sends back a
response.
Examples of servers:
Amazon server
YouTube server
Bank server
Your Spring Boot application
Client asks.
Server responds.
er
Now the important question is:
Ar
How does the browser know how to ask?
m
How does the server understand what the browser is asking?
y
For communication to happen properly, both sides need a common language.
That common language is called HTTP.
What is HTTP?
HTTP stands for:
In simple words:
HTTP is the rulebook for communication between a client and a server.
HTTP defines:
So the browser and server do not randomly exchange text. They follow a proper
format.
HTTP is an application-layer protocol that works on top of TCP/IP.
4. Request–Response Cycle
Every web interaction follows the same basic pattern:
Ar
Server sends response
Client displays or uses the response
m
Example:
y
[Link]/courses
GET /courses
Host: [Link]
Status: 200 OK
Body: course data / HTML page / JSON
Method
URL or path
er
Ar
Example:
m
y
POST /login
Content-Type: application/json
{
"email": "abc@[Link]",
"password": "12345"
}
Meaning:
HTTP Methods
The first line of an HTTP request is called the request line.
It contains the method, path, and HTTP version.
The method tells the server what action the client wants to perform.
Method Meaning Example Use
GET Read data Fetch a list of orders
POST Create data Place a new order
PUT Replace data completely Update an entire user profile
PATCH Update data partially Change only the phone number
DELETE Remove data Cancel an order
HTTP Headers
er
They tell the server things like:
Ar
m
What format the client can understand
What format the request body is in
y
Who the client is
Which host the client is trying to reach
Common examples:
Accept: application/json
Content-Type: application/json
Authorization: Bearer token
Host: [Link]
HTTP Body
The body carries the actual data being sent by the client.
It is commonly used with:
POST
PUT
PATCH
Example body:
{
"name": "Rohit",
"email": "rohit@[Link]"
}
er
data.
Ar
6. Anatomy of an HTTP Response
m
y
An HTTP response usually contains:
Status code
Headers
Body
Example:
HTTP/1.1 200 OK
Content-Type: application/json
{
"message": "Login successful"
}
er
}
}
Ar
m
When we run this program:
y
java Main
The same bytecode can run on Windows, macOS, or Linux as long as the JVM is
available.
Start
Run instructions
Finish
Exit
Start
Keep running
Wait for requests
Process requests
er
Ar
A website is not like a program that runs once and exits.
m
A web server is a program that stays alive continuously and keeps listening for
incoming requests.
y
9. Why Core Java Alone Is Not Enough for
Web Applications
Core Java understands concepts like:
Classes
Objects
Inheritance
Collections
Threads
Files
But Core Java does not automatically understand web concepts like:
HTTP requests
URLs
Headers
Cookies
Sessions
REST APIs
while (true) {
// keep program alive
}
Ar
Someone has to read that request, understand it, and map it to the correct Java
m
logic.
y
10. Can Java Open Network Connections?
Yes, Java can do networking.
Java has had the [Link] package since Java 1.0.
For example:
er
Core Java
Ar
If we tried to build a web application using only Core Java, we would have to
m
handle many things ourselves.
y
We would need to:
1. Open a port using ServerSocket
if ([Link]("/users")) {
// call user logic
} else if ([Link]("/orders")) {
// call order logic
}
Ar
HTTP Request
|
v
m
???
|
y
Java Code
sayHello();
Servlet Container
Servlet
er
Ar
HTTP Request
|
m
v
Servlet
y
|
v
Java Code
Servlets were one of the first standard Java technologies created specifically for
building web applications.
A Servlet runs inside a Servlet Container.
Examples of Servlet Containers:
Apache Tomcat
Jetty
Undertow
er
gives us Java-friendly objects.
Ar
For example, it can call methods like:
m
doGet()
y
doPost()
So the request:
GET /hello
er
It was created to make enterprise Java development easier, cleaner, and more
Ar
maintainable.
Spring introduced important concepts like:
m
y
IoC
Dependency Injection
Bean Management
Configuration
Loose Coupling
Spring Core
Spring MVC
Spring Data
Spring Security
Spring AOP
Spring Boot
Spring AI
er
Spring Core includes:
Ar
m
IoC
Dependency Injection
y
Bean Management
Configuration
ApplicationContext
Servlets
+
Spring Core
@GetMapping("/hello")
public String sayHello() {
return "Hello World";
}
Spring MVC internally uses Servlet technology, but it gives developers a cleaner
programming model.
er
Most applications need to store data permanently.
Ar
For that, applications usually need a database.
m
Earlier, Java developers commonly used JDBC.
y
With JDBC, developers had to:
JPA is a specification.
That means it defines rules and guidelines for how Java objects should be
mapped to database tables.
But JPA itself does not provide the actual working implementation.
Hibernate is one of the most popular implementations of JPA.
In simple words:
er
The flow looks like this:
Ar
m
Spring Data JPA → Hibernate → JDBC → Database
y
A simple way to remember:
JDBC crawled so Hibernate could walk, and Hibernate walked so Spring Data
JPA could fly.
Login
JWT
OAuth
Roles
Permissions
Password encoding
CSRF protection
Access control
Aspect-Oriented Programming
er
Examples of cross-cutting concerns:
Ar
m
Logging
Security checks
y
Transaction management
Performance tracking
Exception handling
These are things that may be needed across many parts of an application.
We will study AOP properly later in the series.
23. Spring AI
Spring AI is a newer part of the Spring ecosystem.
It helps Java developers integrate AI features into Spring applications.
It can work with:
OpenAI
Gemini
Anthropic
Vector databases
RAG systems
Embeddings
AI chat models
This is useful when building AI-powered applications using Java and Spring.
Ar
Embedded servers
Sensible defaults
Production-ready features
m
Less manual configuration
y
In simple words:
Spring Boot configures Spring for us so we can start building applications
quickly.
Embedded Tomcat
Spring MVC setup
Default application structure
JSON support
Basic error handling
Spring Core
Spring MVC
Dependency Injection
IoC
Beans
er
Database concepts
Security concepts
Ar
m
Spring Boot makes development faster, but Spring fundamentals make you a
y
stronger developer.
er
independent services.
Ar
For example:
m
User Service
y
Order Service
Payment Service
Notification Service
Product Service
er
v
Developer writes business logic
Ar
m
This is the bigger picture behind modern Java backend development.
y
29. Why Understanding This History
Matters
Many beginners start directly with Spring Boot and write code like:
@RestController
@GetMapping("/hello")
The code works, but they do not understand what is happening behind the
scenes.
When we understand the journey from:
Client–Server Architecture
HTTP
JVM
Core Java networking
Servlets
Spring Framework
Spring Boot
Ar
HTTP communication
↓
Core Java limitation for web apps
m
↓
Java networking with sockets
y
↓
Manual HTTP parsing problem
↓
Servlets and Servlet Containers
↓
Spring Framework
↓
Spring ecosystem
↓
Spring Boot
Key takeaways:
The goal of this series is not just to write Spring Boot code.
The goal is to understand how modern Java backend development actually works.
Once this foundation is clear, Spring Boot becomes much easier to learn, debug,
and use in real projects.