Definition

Spring Framework

What is the Spring Framework?

The Spring Framework (Spring) is an open source software development framework that provides infrastructure support for building primarily Java-based applications. One of the most popular Java Enterprise Edition (Java EE) frameworks, Spring helps developers create high-performing applications using plain old Java objects (POJOs). Other popular Java frameworks include Java Server Faces (JSF), Maven, Hibernate and Struts.

Released in June 2003 by Rod Johnson under the Apache 2.0 license, the Spring Framework is hosted by SourceForge.

Why Spring?

Java programs are complex and feature many components that are dependent on the underlying OS for their appearance and properties. Spring is considered to be a secure, low-cost and flexible framework that improves coding efficiency and reduces overall application development time through efficient use of system resources.

Spring removes tedious configuration work so that developers can focus on writing business logic. Spring handles the infrastructure so developers can focus on the application.

How Spring works

A web application (layered architecture) commonly includes three major layers:

  1. A presentation layer (UI) that handles the display of content and user interactions.
  2. A business logic layer that deals with the underlying, functional specifications of a program.
  3. A data access layer that supervises data retrieval procedures.

Each layer is dependent on the other for an application to work. For instance, the presentation layer might need to talk with the business logic layer, which in turn interacts with the data access layer. Each of these interactions leads to what are commonly referred to as dependencies and creates couplings between various system components.

One of Spring's core traits is its ability to perform dependency injection, which is a programming pattern that allows developers to build more decoupled architectures. Spring understands different Java annotations that a developer puts on top of classes, and can help make sure that all instances created have properly populated dependencies.

For the Spring Framework to instantiate objects and populate the dependencies, a programmer simply tells Spring which objects to manage and what the dependencies are for each class through annotations. For instance, the @component annotation lets Spring know which classes to manage, marks objects as managed components and identifies classes for dependency injection. As another example, the @autowired annotation tells Spring how to handle the instantiation of the class and to start looking for that dependency among components and classes to find a match.

Important Spring terms

There are a few important terms associated with Spring that developers should know before getting started with the framework:

  • Autowiring. The process by which Spring identifies dependencies and matches and populates them.
  • Dependency injection. A programming design pattern that promotes loose coupling in code, meaning that any change in one area of the application is less likely to affect another.
  • Inversion of control (IoC). A design principle that takes control execution away from a given class and hands it off to a separate management framework.
  • IoC container. This is the portion of the Spring Framework where objects are created, wired together, configured and managed throughout their life cycle.
  • Bean. An object that is instantiated, created and managed by the IoC container. Beans make up the backbone of Spring-based applications.
This was last updated in August 2023

Continue Reading About Spring Framework

Dig Deeper on Application development and design

Software Quality
Cloud Computing
TheServerSide.com
Close