Springs - SPLessons

Spring Modules

Chapter 8

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Spring Modules

Spring Modules

shape Description

Spring Modules – Spring framework comprises of many modules such as follows, Spring module plays the crucial role in the development of Spring framework.Each module will consist of its own functionality that gives more output in easy way.

shape Conceptual

Following is an conceptual figure which describes Spring Modules.

Data Access/Integration:

shape Description

This component embraces of JDBC, ORM, Hibernate, JMS, OXM and translation modules. These modules provide support to deal with databases.

 Spring integration with Hibernate

In Hibernate Framework, developers will provide all the database files will have below extension. 

hibernate.cfg.xml file

While integrating Hibernate with Spring framework database will have below extension.

ApplicationContext.xml file

Use of Spring framework over Hibernate:

Spring framework consists of Hibernate template class, it consists of a set of methods, then the developer can easily work on the applications. Hibernate template class will provide various method to retrieve the information from database and it can collaborate with Hibernate session.

Actual code in Hibernate:

Configuration c=new Configuration();

// session factory object
SessionFactory f=c.buildSessionFactory();

// session object
Session s=f.openSession();

// transaction object
Transaction t=s.beginTransaction();

Student s=new Student(122,"sai",20000);
session.persist(e);//persisting the object

t.commit();// commited

As per the above code Hibernate involves more steps, by using Hibernate Template classes in Spring code will be reduced as follows.

Student s=new Student(122,"sai",20000);

Methods of Hibernate template class

Method Functionality
Void persist(object entity)  object will be persists by this method.
Serializable save(object entity)  returns id after persisting object.
Void saveOrUpdate(Object entity) after finding id it updates else saves .
Void update(object entity)  object will be updated.
Void delete(object entity) object will be deleted depends on id.
Object get(Class entityClass,Serializable id)  persistent object will be returned depends on id.
Object load(Class entityClass,Serializable id) persistent object will be returned depends on id.
List loadAll  persistent object returns.


shape Description

This component embraces of web, web-struts, web-servlet, web-portlet and supports to develop scalable and loosely coupled web applications.


shape Description

It permits developers to present custom aspects.It breaks the programming logic into various parts called concerns.


Aspect module provides support to integrate with AspectJ.AspectJ is an extension of AOP.


It provides support to class instrumentation and class loader presentation.

Spring core container

shape Description

Spring core container consists of core and J2ee containers and beans,expression language.

Core and Beans

It gives inversion of control, DI(Dependency Injection) features.


Context supports EJB, JMS and basic remoting.

Expression language

It is an extension to the JSP EL. It provides supports to getting and setting property values, method invocation, indexers, named variables, retrieval of objects by name.


shape Points

  • Integration of Hibernate with Spring framework gives results quickly with less code.
  • Spring framework provides Hibernate template class.
  • Spring Modules – Web-MVC framework provides flexible and loosely coupled web applications.
  • Spring Modules – The IOC and Dependency injection are the core components of Spring framework.