Home > Chapter 2 - Introduction to Spring > Spring Framework Introduction

Spring Framework Introduction


Chapter 2: Introduction to Spring


Spring Framework:

The Spring framework is a comprehensive layered Java/Java EE application platform. It was created to address the complexity of enterprise application development. The Spring Framework takes best practices and design patterns that have been proven over the years, codifies these patterns as first class objects that can be integrated into applications. Spring makes it possible to use plain-vanilla Java Beans (POJOs) to achieve things that were previously only possible with EJBs.


Spring includes:

  • An IOC lightweight container
  • AOP functionality
  • Abstraction layer for JDBC / transaction management                    
  • ORM integration layer
  • Web integration layer
  • A flexible MVC web application framework 


Spring is not only an application framework, it also serves as a platform for several open source projects that are based on the core Spring Framework project such as Spring IDE, Spring Security, Spring Web Flow, Spring Web Services, Spring Rich Client,  Spring Batch, Spring Modules, Spring Dynamic Modules, Spring Integration, Spring LDAP, Spring JavaConfig, Spring .NET, Spring BeanDoc.


Spring’s features:


Spring makes it possible to develop and maintain complex applications using simple components. In Spring, application objects are configured declaratively typically in an XML file. Spring also provides much infrastructure functionality (transaction management, integration, etc.), leaving only the development of application logic to you.



Spring is lightweight in terms of both size and overhead. Spring Framework can be distributed in a single JAR file that weighs just over 2.5 MB and the processing overhead required by Spring is negligible. Spring is non intrusive in a way that the objects in a Spring-enabled application often have no dependencies on Spring-specific classes.



Spring provides a container which contains and manages the lifecycle and configuration of application objects. In Spring, you can declare how each of application objects should be created, how they should be configured, and how they should be associated with each other.


Dependency Injection:

Spring promotes loose coupling through dependency injection (DI). When DI is applied, objects are passively given their dependencies instead of looking for dependencies themselves. You can think of DI as JNDI in reverse — instead of an object looking up for dependencies from a container, the container gives the dependencies to the object at its instantiation without waiting to be asked.



Spring comes with rich support for aspect-oriented programming (AOP) that enables separating application business logic from system services (such as auditing, transaction management, logging etc). Application objects do what they’re supposed to do i.e., perform business logic — and nothing more. They are not responsible for or even be aware of other system concerns, such as logging or transactional support.


Spring Framework Architecture:

The Spring Framework contains a lot of features, which are well-organized in modules as shown in the figure below.


Spring Modules




The Core package is the most fundamental part of the framework and provides the IoC and Dependency Injection features. It provides a basic Spring IoC container implementation called BeanFactory which implements the factory design pattern and allows decoupling the configuration and dependency specification from the program logic.



The Context package is built on top of the Core package. Hence it inherits features from the beans package (org.springframework.beans) and provides an advanced Spring IoC container implementation called ApplicationContext which provides support for internationalization (I18N), event-propagation, resource-loading, and creation of contexts for example, a servlet container.



This package defines an abstract layer on top of the native JDBC API, which supports template-based approach that dispenses the tedious boilerplate JDBC code. It also parses database vendor–specific error codes into Spring’s DataAccessException hierarchy.



This package supports both programmatic and declarative approaches to manage transactions. These can be used to add transaction capability not only for classes implementing special interfaces, but for all ordinary POJOs (plain old Java objects).



The ORM package provides integration layers for popular object-relational mapping APIs such as JPA, JDO, Hibernate, and iBatis. Using the ORM package you can use these frameworks in combination with all the other features Spring offers, such as the simple declarative transaction management feature.



Spring’s AOP package provides an AOP Alliance-compliant aspect-oriented programming implementation referred to as Spring AOP that addresses cross-cutting concerns and also decoupling it from the functional code.


Web Framework Integration:

Spring’s Web package provides integration layer for popular web frameworks such as WebWork, Struts, JSF etc. It also provides features such as multipart file-upload functionality, initialization of the IoC container using servlet listeners and a web-oriented application context.


Spring MVC:

This package provides a Model-View-Controller (MVC) implementation for web-applications. It provides a clean separation between domain model and web forms, and also allows you to use all the other features of the Spring Framework.


Portlet MVC:

This package establishes a portlet framework, also conforming to the MVC design pattern.


Enterprise Integration:

This package provides an integration layer for popular enterprise services including several remoting technologies, EJB, JMS, JMX, e-mail, and scheduling.



This package provides support for both unit testing and integration testing. It provides a Spring Test Context framework abstracting underlying testing frameworks such as JUnit 3.8, JUnit 4.4, and TestNG.






  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: