Spring
Spring Framework Overview
Spring is the most popular application development framework for enterprise Java. Millions of
developers around the world use Spring Framework to create high performing, easily testable, reusable
code.
Benefits of Using Spring Framework:
Following is the list 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 is organized in a modular fashion
• 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.
• 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).
Spring Framework Architecture
.
1. The Core Container consists of the Core, Beans, Context, and Expression Language modules whose
detail is as follows:
a. The Core module provides the fundamental parts of the framework, including the IoC and
Dependency Injection features.
b. The Bean module provides BeanFactory which is a sophisticated implementation of the
factory pattern.
c. The Context module builds on the solid base provided by the Core and Beans modules and it
is a medium to access any objects defined and configured. The ApplicationContext interface
is the focal point of the Context module.
d. The Expression Language module provides a powerful expression language for querying and
manipulating an object graph at runtime.
2. The Data Access/Integration layer consists of the JDBC, ORM, OXM, JMS and Transaction modules
whose detail is as follows:
a. The JDBC module provides a JDBC-abstraction layer that removes the need to do tedious
JDBC related coding.
b. The ORM module provides integration layers for popular object-relational mapping APIs,
including JPA, JDO, Hibernate, and iBatis.
c. The OXM module provides an abstraction layer that supports Object/XML mapping
implementations for JAXB, Castor, XMLBeans, JiBX and XStream.
d. The Java Messaging Service JMS module contains features for producing and consuming
messages.
e. The Transaction module supports programmatic and declarative transaction management
for classes that implement special interfaces and for all your POJOs.
3. The Web layer consists of the Web, Web-Servlet, Web-Struts, and Web-Portlet modules whose
detail is as follows:
a. The Web module provides basic web-oriented integration features such as multipart file-
upload functionality and the initialization of the IoC container using servlet listeners and a
web-oriented application context.
b. The Web-Servlet module contains Spring's model-view-controller (MVC) implementation for
web applications.
c. The Web-Struts module contains the support classes for integrating a classic Struts web tier
within a Spring application.
d. The Web-Portlet module provides the MVC implementation to be used in a portlet
environment and mirrors the functionality of Web-Servlet module.
4. Miscellaneous:
a. There are few other important modules like AOP, Aspects, Instrumentation, Web and Test
modules whose detail is as follows:
b. The AOP module provides aspect-oriented programming implementation allowing you to
define method-interceptors and pointcuts to cleanly decouple code that implements
functionality that should be separated.
c. The Aspects module provides integration with AspectJ which is again a powerful and mature
aspect oriented programming (AOP) framework.
d. The Instrumentation module provides class instrumentation support and class loader
implementations to be used in certain application servers.
e. The Test module supports the testing of Spring components with JUnit or TestNG
frameworks.