The Spring Framework is an open source application framework and inversion of control container for the Java platform that software engineers can use. Any of the Java applications can use the framework’s main features, but there are extensions available to assist the development of web applications on top of the Java EE platform. While the framework does not follow a particular programming model, it has become well recognized for replacing or adding on to the Enterprise JavaBean (EJB) model.
The first version was written by Rod Johnson, who published the book Expert One-on-One J2EE Development without EJB in October 2002, releasing the framework. The framework was officially released June 2003 under the Apache 2.0 license. Further milestone releases continued through 2005.
The Spring Framework is a Java platform that provides comprehensive infrastructure support for developing Java applications. You can focus on your application while Spring takes care of the infrastructure.
Spring allows programmers to build applications from “plain old Java objects” (POJOs) and to apply enterprise services to POJOs without being invasive, which applies to the Java SE programming model and to full and partial Java EE.
Fig 1: Overview of the Spring Framework
The Core Container contains the spring-core, spring-beans, spring-context, spring-context-support, and spring-expression (Spring Expression Language) modules.
The Core module contains the framework’s foundational parts, including the Inversion of Control (IoC) and Dependency Injection features.
The Bean module includes the BeanFactory, a sophisticated implementation of the factory pattern.
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.
The SpEL module allows for a strong expression language, used for querying and manipulating an object graph at runtime.
The AOP module of Spring Framework provides aspect-oriented programming implementation allowing you to define method-interceptors and pointcuts to cleanly decouple code that implements functionality that should be separated.
The Spring-aspects module allows the framework to integrate with AspectJ.
The Spring-instrument module gives support for class instrumentation and classloader implementations to be used in certain application servers.
Spring Framework 4 includes a Spring-messaging module with key abstractions from the Spring Integration project such as Message, Message Handler, Message Channel, and others to serve as a foundation for messaging based applications. The module also includes annotations for mapping messages to methods, similar to the annotation based programming model Spring MVC.
The Data Access/Integration layer consists of the JDBC, ORM, OXM, JMS, and Transaction modules.
The Spring-jdbc module creates a JDBC-abstraction layer that removes the need to do tedious JDBC coding and parsing of database-vendor specific error codes.
The Spring-tx module allows declarative and programmatic transaction management for classes that implement special interfaces and for all your POJOs (Plain Old Java Objects).
The Spring-orm module provides integration layers for popular object-relational mapping APIs, including JPA, JDO, and Hibernate. With the spring-orm module, you can make use of all of these O/R-mapping frameworks in combination with all of the other features offered in Spring, like the previously mentioned simple declarative transaction management feature.
The Spring-oxm module supports Object/XML mapping implementations such as JAXB, Castor, XMLBeans, JiBX and XStream through an abstraction layer.
The Spring-jms module (Java Messaging Service) contains features for producing and receiving messages. It provides integration with the spring-messaging module since Spring Framework 4.1.
The Web layer consists of the spring-webmvc, spring-websocket, spring-web, and spring-webmvc-portlet modules.
The spring-web module provides basic web-oriented integration features such as multipart file upload functionality and the initialization of the IoC container using a web-oriented application context and Servlet listeners. An HTTP client and the web-related parts of Spring’s remoting support are also a part of it.
The spring-webmvc module (also known as the Web-Servlet module) contains Spring’s model-view-controller (MVC) and REST Web Services implementation for web applications. Spring’s MVC framework cleanly separates the domain model code and web forms and integrates with all of the other features of the Spring Framework.
The spring-webmvc-portlet module (also known as the Web-Portlet module) provides the MVC implementation to be used in a Portlet environment and mirrors the functionality of the spring-webmvc module.
[See Also: Mobile Test Automation Using Robot Framework]
The spring-test module supports the unit testing and integration testing of Spring components with JUnit or TestNG. It allows for consistent loading of Spring Application Contexts and caching of those contexts. It also allows you to use mock objects to test your code in isolation.
Everything you need to know about outsourcing technology development
Access a special Introduction Package with everything you want to know about outsourcing your technology development. How should you evaluate a partner? What components of your solution that are suitable to be handed off to a partner? These answers and more below.