What is Spring Framework?

What is Spring Framework?

In this tutorial, we will discuss what is spring framework, and the different types of spring versions.

Spring Framework is one of the most popular Java-based application frameworks. Spring framework is an open-source java platform, and it was created by “Rod Johnson” in 2003. 

Spring is a complete and modular framework. It means we can use Spring framework for all layer implementations for a real-time application, or we can use spring for the development of a particular layer of a real-time application, unlike struts [only for front end related] and hibernate [only for database related], but with spring we can develop all layers.

Spring framework can be thought of as a framework of frameworks because it provides support to various frameworks such as StrutsHibernate, EJB, JSF, etc. Using web frameworks, we can develop web applications. Using ORM frameworks, we can develop persistence logic. But using the spring framework, we can develop all kinds of logic like business logic, persistence logic, integration logic, presentation logic, etc. 

Using the spring framework, we can develop all kinds of applications like standalone, two-tire, web, distributed, and enterprise. 

Spring 1.X contains 7 modules, spring 2.X contains 6 modules, and spring 3.X contains 20 modules, but they are grouped into 6 major categories. Spring 1.X overview diagram is as follows

What is Spring Framework?

Spring 2.X overview diagram is as follows,

Spring 3.X overview diagram is as follows,

Spring 4.X overview diagram is as follows,

Core Module

The spring core module is fundamental in Spring Framework. It has provided a basic foundation for all other spring framework modules. We can use this module to prepare Standalone Applications directly. This module can provide the features like IOC Containers, Beans, Dependency Injection, etc.

AOP Module [Aspect Oriented Programming]

In general, if we prepare enterprise applications using only Object Orientation, we have to provide both business logic and Services like Transactions, JMS, JAAS, etc., in a combined manner. It will provide a tightly coupled design, and it will provide less shareability and less reusability.

To improve shareability and Reusability in the above context, we have to provide a loosely coupled design. To get a loosely coupled design, we have to apply Aspect-Oriented Programming. In Aspect-Oriented Programming, we will declare every service as an aspect and inject these aspects in Business Logic at runtime.

JDBC/DAO Modules

The main intention of this module is to interact with the database from the Spring application to perform database operations with the JDBC Persistence mechanism. JDBC/DAO modules can abstract common JDBC implementation to simplify Database interaction from spring applications by providing template classes.

In JDBC, if we want to interact with the database, we must use the following steps.

1. Load And Register Driver


2. Establish Connection between Java application and Database.

Connction conn = DriverManager.getConnection("jdbc: oracle:thin:@localhost:1521:xe", "ashok", "ashok");

3. Create Statement/PreparedStatement/CallableStatement as per the requirement.

Statement st = conn.createStatement();

4. Write and Execute SQL Queries

ResultSet rs = st.executeQuery("select * from emp");

5. Close the Connection


In the above JDBC Steps, Load and Register Driver, Establish Connection and Create Statement and close the Connection are common in all the JDBC applications. Here, the Spring JDBC/DAO modules can abstract the commonly used steps and give the developers an option to provide variable parts, that is, Executing SQL queries.

Spring DAO and JDBC modules have their own Exception Classes hierarchy to expose the exception details. Spring DAO/JDBC modules convert the JDBC generates checked exceptions to Spring defined Unchecked Exceptions using Exceptions Re-Throwing Mechanism.

ORM Module [Object-Relational Mapping]

The process of mapping Java class with a Database table, member variables with table columns, and making that java class objects represent Database table rows by synchronizing between them is called ORMapping.

ORM has defined a set of rules and regulations to provide a mapping between the Object-Oriented Data Model and Relational Data Model to achieve data persistency.

E.g. Hibernate, JPA, Toplink etc.

To prepare the Hibernate Application then we have to use the following instructions.

1. Create Configuration class object.

Configuration cfg = new Configuration();

2. Create SessionFactory class object

SessionFactory sf = cfg.buildSessionFactory();

3. Create Session object

Session s = sf.openSession();

4. Perform Persistence operations

Object obj = s.load("com.ashok.hibernate.model.Employee.class", 111);

5. Close SessionFactory and Configuration


In the above Hibernate Application steps, Create Configuration class object, Create SessionFactory object, create a Session object, and close SessionFactory and Configuration steps are common in all hibernate applications. In this case, the Spring ORM module can abstract all the common instructions to simplify Data persistence in enterprise applications.

Spring ORM module has provided its own Exceptions hierarchy to expose behalf of the underlying Persistence mechanism like Hibernate, JPA, etc., provided checked exceptions.

JAVA EE/Context/Remoting

The main intention of this module to integrate Spring applications with the distributed tech applications like EJBs, RMI etc. it able to get middleware services like JNDI, JTA, JAAS etc. from J2EE.


WEB Module has provided a good environment for integrating other MVC-based framework applications like Struts, JSF, XWork2, etc.

WEB-MVC is an MVC implementation provided by the Spring framework directly to prepare web applications.


Spring Framework has provided its own testing environment to test the enterprise applications by the developers [Unit Testing] in their own way in the form of a Test module.


Spring framework has provided the Test module right from its Spring3.x version.


Spring Framework has provided Instrumentation API to perform manipulations over the actions generated from the .class files without modifications over the source code.


Spring Framework has provided the Messaging module and its Spring4.x version to provide Messaging Services that JMS provided previously as part of J2EE.


When we perform any transactions in a bank application, we can receive mobile updates. In this context, if our mobile device is not ready to receive messages.

WEB Module has provided a good environment for integrating other MVC-based framework applications like Struts, JSF, XWork2, etc. We have to keep the respective message in Messaging Container or JMS Server to send the respective message when the target machine/device is ready.

What is Spring Framework?

Scroll to top