Spring Tutorial- Learn Spring Core Framework Steps

Spring Tutorial

In this series of spring tutorial, it’s provides many step by step examples and explanations on using Spring framework. The Spring framework , created by Rod Johnson, is an extremely powerful Inversion of control(IoC) framework to helps decouple your project components’ dependencies.

On Oct 2002– The first version released on book (Expert One-on-One J2EE Design and Development) by Rod Johnson.
On Jun 2003– Take license from Apache and First released as a Framework.
Jan 2006- Won the two awards Jolt productivity award and JAX Innovation Award.
On Oct 2006– Spring 2.0 released.
On Nov 2007– Spring 2.5 released.
On Dec 2009 – Spring 3.0 released.
On Dec 2011– Spring 3.1 released.
On Jun 2012– Spring 3.2 released.
On December 2013– Spring 4.0 released.
On 31 July 2015– Spring 4.2 released.
On 10 June 2016– Spring 4.3 released.
Next, Spring 5 is announced to be built upon Reactive Streams compatible Reactor Core.

Spring Tutorial: What is Spring?

Spring is great framework for development of Enterprise grade applications. It is a light-weight framework for the development of enterprise-ready applications. It provides very simple and rich facilities to integrate various frameworks, technologies, and services in the applications. One of the main reason for using the Spring framework is to keep code as simple as possible. It push the way to develop enterprise applications with loosely coupled simple java beans. For this reason, the spring framework can also be called a Plain Old Java Object (POJO) framework.

Spring is an open-source framework developed by Spring Source, a division of VMware. Spring frame work can summarized in two ways. Let’s see Spring in to two parts in this Spring Tutorial.

  • Container-Spring framework can be described as a light weight container, as it does not involve installation, configuration, start and stop activities associated with a container. It is just a simple collection of few Java ARchive (JAR) files that need to be added to the classpath. The Spring Container takes the classes in the application, creates objects, and manages the life cycle of those objects.
  • Framework-Spring framework can be described as an Application Programming Interface(API) containing  a large collection of the classes, methods, interfaces, annotations, XML tags that can be used in an application. The API provides a variety of factory and facade classes that help you to use any framework or functionality very easily in your application.
Spring Framework Overview

Spring Framework Overview

Data Access Using Java Database Connectivity (JDBC):

The Spring framework provides a rich support for working with JDBC. A typical JDBC code involves plumbing works, such as creating connection, statements, executing queries and handling exceptions for performing database operations.Spring framework provides a set of classes that take care of these core JDBC operations.

Data Access Using Object Relational Mapping (ORM):

There are lots of ORM frameworks, such as Hibernate, Toplink, iBatis etc that can be used in Java Applications. Spring framework provides lots of classes that makes working with ORM is very easy.

Aspect Oriented Programming (AOP):

One of the main paradigms that spring uses to provide enterprise services for your applications is AOP. AOP is a mechanism by which you can introduce functionality in your existing code without modifying your design.  In short, we can use AOP to weave cross-cutting functionalities or aspects into the code. The Spring framework uses AOP provides various enterprise services such a transaction and security in an application.

spring certification

Core Spring Framework:

The Core package is the most fundamental part of the framework and provides the IoC and Dependency Injection features. The basic concept here is the BeanFactory, which provides a sophisticated implementation of the factory pattern which removes the need for programmatic singletons and allows you to decouple the configuration and specification of dependencies from your actual program logic.

Spring’s MVC:

Spring MVC package provides a Model-View-Controller (MVC) implementation for web-applications. Spring’s MVC framework is not just any old implementation; it provides a clean separation between domain model code and web forms, and allows you to use all the other features of the Spring Framework.

Object XML Mapping:

Spring 3.0 introduces the OXM module that was earlier not a part of the core framework. OXM is a mechanism that marshals or converts object into the XML format and vice versa. There are lots of OXM frameworks, such as Caster, Xstream, JiBX, Java API for XML Binding(JAXP), and XMLMeabs. Spring 3.0 provides a uniform API to access any of these OXM frameworks for marshalling and unmarshalling object and XML.

Dependency Injection (DI):

The technology that Spring is most identified with is the Dependency Injection (DI) flavor of Inversion of Control. The Inversion of Control (IoC) is a general concept, and it can be expressed in many different ways and Dependency Injection is merely one concrete example of Inversion of Control.

What is dependency injection exactly?

Let’s look at these two words separately. Here the dependency part translates into an association between two classes. For example, class X is dependent on class Y. Now, let’s look at the second part, injection. All this means is that class Y will get injected into class X by the IoC. Here we don’t need to write lots of code to create the instance of the dependent classes.

Spring Dependency

Dependency injection promotes loose coupling . It paves the way for the removal of the usal factory and utility classes that we write in our applications.
Look Following in this Spring Tutorial:

  • The DAO classes use Data Sources, we can inject it into DAO classes.
  • The Service classes may need to add few java beans

Dependency Injection is also known as Inversion of Control or IoC.  The IoC refers to the control of creating instances. The container has responsibility to control for creating and constructing objects. The container creates objects and injects then into our applications. Let’s look into the benefits of Spring Tutorial.

Benefits of Using Spring Framework:

Here I have listed following list in this Spring Tutorial of few of the great benefits of using Spring Framework:

  • Spring enables developers to develop enterprise-class applications using POJOs. The benefit of using only POJOs is that you do not need an EJB container product such as an application server but you have the option of using only a robust servlet container such as Tomcat or some commercial product.
  • Spring has multiple modules in a modular fashion. Even though the number of packages and classes are substantial, you have to worry only about ones you need and ignore the rest.
  • Spring does not reinvent the wheel instead, it truly makes use of some of the existing technologies like several ORM frameworks, logging frameworks, JEE, Quartz and JDK timers, other view technologies.
  • Testing an application written with Spring is simple because environment-dependent code is moved into this framework. Furthermore, by using JavaBean-style POJOs, it becomes easier to use dependency injection for injecting test data.
  • Spring’s web framework is a well-designed web MVC framework, which provides a great alternative to web frameworks such as Struts or other over engineered or less popular web frameworks.
  • Spring provides a convenient API to translate technology-specific exceptions (thrown by JDBC, Hibernate, or JDO, for example) into consistent, unchecked exceptions.
  • Lightweight IoC containers tend to be lightweight, especially when compared to EJB containers, for example. This is beneficial for developing and deploying applications on computers with limited memory and CPU resources.
  • Spring provides a consistent transaction management interface that can scale down to a local transaction (using a single database, for example) and scale up to global transactions (using JTA, for example).


Contents for Spring Tutorial

  1. Dependency Injection in Spring
  2. Setting up Environment of Spring
  3. Hello Word Example in Spring
  4. Spring IoC Container
  5. What is Bean Factory in Spring
  6. Application Context in Spring
  7. Constructor & Object Injecting 
  8. Injecting Inner Beans in Spring with Example
  9. Injecting Collection in Spring
  10. Bean Autowiring in Spring
  11. Understanding Bean Scopes
  12. Using ApplicationContextAware in Spring
  13. Bean Definition Inheritance in Spring
  14. Bean Lifecycle and Callbacks 
  15. Writing a BeanPostProcessor
  16. Writing a BeanFactoryPostProcessor
  17.  Coding To Interfaces in Spring
  18.  Introduction to Annotations and Based Configuration
  19. The Autowired Annotation
  20. Some JSR-250 Annotations
  21. JSR 330 Annotations in Spring
  22. Component and Stereotype Annotations 
  23. Using Property Files by MessageSource in Spring
  24. Event Handling in Spring 
  25. Introduction to AOP in Spring
  26. Setting Up AOP Dependencies
  27. Writing First AspectJ Program in Spring
  28. Pointcuts and Wildcard Expressions  
  29. JoinPoints and Advice Arguments
  30. After Advice Type and Around Advice Type
  31. AOP XML configuration
  32. Understanding AOP Proxies
  33. Spring JDBC Framework
  34. Using JdbcTemplate
  35. Implementing RowMapper 
  36. DAO Support Classes
  37. Transaction Management
  38. Using Hibernate with Spring
  39. Web Framework Spring MVC
  40. Logging with Log4J in Spring Example
  41. Batch Process with Spring and Example
  42. Interview Questions on Spring Framework

Free Test Practice Spring Core Certification



  1. Anonymous June 14, 2012
  2. Anonymous September 4, 2012
    • Dinesh Rajput September 9, 2012
  3. SEDOTSInfo September 7, 2012
  4. Dinesh December 30, 2012
  5. Anonymous August 30, 2013
    • Dinesh August 31, 2013