Stage 1 — What Spring Framework Is and Why It Exists

Spring Framework is a Java framework for building applications from managed objects instead of manually assembled classes. Its core idea is simple: an application contains many objects, and something has to create them, connect them, configure them, and give them shared capabilities such as transactions, security, and HTTP handling. In Spring, that job belongs to the container.

Without a framework, a growing Java application quickly becomes a collection of manual decisions. One class creates another class with new, configuration is read in several places, database access is repeated, security checks are scattered, and changing one implementation can require edits across many files. Spring exists to move this repeated infrastructure work into one consistent model.

Spring Framework architecture

The problem Spring solves

A real backend application rarely consists of one class. It usually has controllers, services, repositories, external API clients, validators, mappers, configuration classes, and data objects. These parts depend on each other. For example, a controller needs a service, the service needs a repository, and the repository needs infrastructure for database access.

If every class creates its own dependencies, the code becomes rigid. The controller starts knowing which exact service to create. The service starts knowing which exact repository to use. Testing becomes harder because you cannot easily substitute a test implementation. Changing the system also becomes harder because object connections are hidden inside code.

Spring solves this with a container and Beans. A Bean is an object managed by Spring. The container creates Beans, stores them, passes one Bean into another through dependency injection, and controls their lifecycle. As a result, classes describe their dependencies explicitly, usually through constructors, instead of assembling the full object graph by hand.

Typical Spring application chain

Most Spring backend applications are organized in a similar way: a request enters a controller, the controller calls a service, the service performs business logic, the repository works with the database, and the result returns through the same chain. This is not a strict law for every project, but it is the baseline structure you should understand before studying Spring MVC, Spring Data, and Spring Security.

Typical Spring application chain

The controller owns the HTTP boundary. It receives the request, reads path/query/body parameters, starts validation, and returns an HTTP response. Complex business rules should not live in the controller because that mixes the HTTP layer with domain logic.

The service owns the use case: create an order, register a user, calculate a price, or change a ticket status. This is where the main application logic lives. A service may call multiple repositories, other services, external APIs, and transaction boundaries. The repository owns data access: load an entity, save changes, or execute a database query.

Layer What it does What it usually should not do
Controller Receives HTTP request and returns response Hold complex business logic
Service Runs an application business scenario Know HTTP protocol details
Repository Works with a database or storage Decide business rules
Configuration Creates settings and infrastructure Beans Contain use case logic
Security/Validation/Transactions Add common rules around main layers Be duplicated manually in every method

What Spring consists of

At the bottom is the Core Container. This is where ApplicationContext, Beans, IoC, DI, lifecycle, configuration, and post-processing live. You can think of ApplicationContext as the main runtime storage of the application: it contains the objects Spring created and connected.

Spring MVC builds web applications on top of the container. It maps HTTP requests to controller methods, converts request data into Java objects, validates input, and renders responses. Spring Data simplifies persistence through repository abstractions and integration with JPA or other stores. Spring Security handles authentication and authorization: who the user is and what the user is allowed to do. Transaction support keeps database work inside consistent boundaries.

Spring Boot is related to Spring, but it is not the same thing. Boot sits on top of Spring and reduces setup work. It adds auto-configuration, starters, embedded server support, production defaults, and Actuator. Boot does not replace Spring Core; it uses it and assembles a typical application faster.

Why Spring is useful in real projects

Spring makes large Java applications easier to reason about. You can open a service constructor and see what it depends on. You can replace an implementation through configuration or a profile. You can add transactional behavior through a Spring annotation and infrastructure instead of manually opening and closing transactions in every method. You can debug startup by asking which Bean was not created, which dependency is missing, and which configuration was activated.

The important point is that Spring does not remove complexity completely. It moves complexity into explicit framework mechanisms. That is why learning Spring only through annotations is not enough. An annotation is usually a marker that enables a mechanism. To use Spring confidently, you need to understand which mechanism is enabled and where it fits at runtime.

How this course is ordered

The route is intentionally linear: Stage 1 Spring Framework overview -> Stage 2 Core Container, IoC, and DI -> Stage 3 Boot auto-configuration -> Stage 4 Web MVC -> Stage 5 Data JPA -> Stage 6 Security -> Stage 7 Testing. Skipping the container stage creates a false sense of understanding because Boot, MVC, Data, and Security all rely on container-managed Beans.

The goal is not to memorize more annotations. The goal is to predict framework behavior before runtime. Once the container, Beans, and the common controller -> service -> repository chain are clear, Spring Boot stops looking like magic and becomes a set of explainable decisions.

Stage takeaway

Spring Framework is an application framework built around a managed object container. It helps Java teams build modular systems where object creation, dependency wiring, configuration, web handling, data access, security, and transactions follow one consistent model. Spring Boot makes this model faster to start, but the foundation is still Spring Framework.

Glossary
bean
An object managed by the Spring container.
IoC
Inversion of Control, a design principle where a framework manages object creation and wiring.
dependency injection
A technique where required dependencies are provided to an object from the outside.
application context
The Spring container that stores beans, configuration, and runtime wiring.
auto-configuration
Spring Boot behavior that configures application components based on dependencies and settings.
starter
A Spring Boot dependency bundle that brings related libraries and default configuration together.
dependency management
The practice of controlling dependency versions and relationships in a project.
controller
A component that handles incoming requests and returns responses or view models.
service layer
The application layer where business logic and use-case orchestration usually live.
repository layer
The application layer responsible for data access and persistence operations.
REST controller
A controller that exposes HTTP endpoints and usually returns JSON or another response body.
endpoint
A specific API address and operation that clients can call.
request mapping
The configuration that connects an HTTP request path and method to controller code.
Spring Security
The Spring project used to implement authentication, authorization, and security filters.
authentication
The process of proving who a user or client is.
authorization
The process of deciding what an authenticated user or client is allowed to do.
filter chain
An ordered set of web filters that process a request before it reaches the application handler.
observability
The ability to understand system behavior from signals such as logs, metrics, traces, and health checks.