What is Spring framework and why is it used?

The Spring Framework is a lightweight framework that improves coding efficiency and reduces overall application development time through efficient use of system resources. We can also say that it is the framework of framework that provides support to various frameworks such as Struts, Hibernate, EJB, JSF, Tapestry, etc.

Spring removes tedious configuration work so developers can focus on writing business logic.

Advantages of Spring Framework:

  1. Predefined Templates

Spring framework contains predefined templates for JDBC, Hibernate, and, JPA technologies. This reduced the code and task of the developer to manually write a logic for creating a statement or transaction management.

  1. Loose Coupling

Since Spring has Dependency injection applications are loosely coupled.

  1. Easy to Test

The dependency injection in spring makes it easier to test the application.

  1. Lightweight IoC

Spring framework is lightweight because of its POJO (Plain Old Java Object) implementation. Spring framework does not force to inherit any class or implement any interfaces due to which it is called non-invasive.

  1. Fast Development

Developing JavaEE applications is comparatively fast because of dependency injection 

  1. Declarative Support

Spring provides declarative support for catching, transactions, validations, and formatting.

  1. Powerful abstraction

It provides a powerful abstraction to JavaEE specifications such as JDBC, JMS, JPA, JTA, etc.


The Spring framework comprises several modules such as 

  1. Inversion of Control(IOC)
    • IOC makes the code loosely coupled. In the Spring framework, the IOC container is responsible for injecting the dependency. We provide metadata to the IOC container either by XML file or annotation.
  1. Aspect Oriented Programming (AOP)
    • AOP praises Object-Oriented Programming in such a way that it also provides modularity. However, the key point of modularity is the aspect of the class. AOP breaks the program logic into separate parts called concerns.
    • Aspect-oriented programming (AOP) is one of the key elements of the Spring Framework.
  1. Data Access Object (DAO)
    • The Data Access Object (DAO) support in Spring is aimed at making it easy to work with data access technologies (such as JDBC, Hibernate, or JPA) in a consistent way.
    • Spring-DAO is not a spring module. It does not provide interfaces or templates to access the data. One important change that needs to be written while using Spring DAO is, that it has to be annotated with @Repository.
  1. Application Context
    • This is a Central interface to provide configuration for an application. This is read-only while the application is running, but may be reloaded if the implementation supports this.
    • ApplicationContext is the sub-interface of BeanFactory.
    • Spring IoC container is responsible for instantiating, wiring, configuring, and managing the entire life cycle of objects. BeanFactory and ApplicationContext represent the Spring IoC Containers.
  1. Object Relation Mapping (ORM)
    • Spring-ORM is a technique or a Design Pattern used to access a relational database from an object-oriented language.
    • Spring provides API to easily integrate Spring with ORM frameworks such as Hibernate, JPA(Java Persistence API), JDO(Java Data Objects), Oracle Toplink, and iBATIS.
  1. WEB MVC (model-view-controller)
    • A Spring MVC is a Java framework that is used to build web applications. It follows the Model-View-Controller design pattern.
    • The Spring Web model-view-controller (MVC) framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution, locale, and theme resolution as well as support for uploading files.

-A blog by Shwetali Khambe

Related Posts