Spring Web MVC
The Spring Framework is an open source application framework for the development of Java platform enterprise grade applications. Spring can be used to configure declarative transaction management, remote access to our logic using RMI or web services, mailing facilities and various options to persist our data to databases. Spring framework can be used in modular fashion and it allows the component-bases web application development.
The first version was written by Rod Johnson who released the framework with the publication of his book Expert One-on-One J2EE Design and Development in October 2002. The framework was first released under the Apache 2.0 license in June 2003. The first milestone release, 1.0, was released in March 2004, with further milestone releases in September 2004 and March 2005. The Spring 1.2.6 framework won a Jolt productivity award and a JAX (Java API for XML) Innovation Award in 2006. Spring 2.0 was released in October 2006, Spring 2.5 in November 2007, Spring 3.0 in December 2009, Spring 3.1 in December 2011, and Spring 3.2.5 in November 2013. Spring Framework 4.0 was released in December 2013. Notable improvements in Spring 4.0 included support for Java SE (Standard Edition) 8, Groovy 2, some aspects of Java EE 7, and WebSocket. Spring Framework 4.3 has been released on 10 June 2016 and will be supported until 2020.
The core features of the Spring Framework can be used by any Java application, but there are extensions for building web applications on top of the Java Enterprise platform. Although the Spring Framework does not impose any specific programming model, it has become popular in the Java community as an alternative to, replacement for, or even addition to the Enterprise JavaBean (EJB) model.
The Spring Framework comprises several modules that provide a range of services —
♦ Inversion of Control container: Configuration of application components and life-cycle management of Java objects.
♦ Aspect-oriented programming (AOP): Enables implementation of breaking of code into different modules, also known as modularisation, where the aspect is the key unit of modularity.
♦ Data access: Working with relational database management systems on the Java platform using JDBC and object-relational mapping tools.
♦ Transaction management: Unifies several transaction management APIs and coordinates transactions for Java objects.
♦ Model-view-controller: An HTTP and Servlet-based framework providing hooks for extension and customization.
♦ Remote Access framework: Configurative RPC-style export and import of Java objects over networks supporting RMI, CORBA and HTTP-based protocols including web services (SOAP).
♦ Convention-over-configuration: A rapid application development solution for Spring-based enterprise applications is offered in the Spring Roo module.
♦ Batch processing: A framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management.
♦ Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly Acegi).
♦ Remote Management: Configurative exposure and management of Java objects for local or remote configuration via Java Management Extensions (JMX).
♦ Messaging: Configurative registration of message listener objects for transparent message consumption from message queues via JMS, improvement of message sending over standard JMS APIs.
♦ Testing: Support classes for writing unit tests and integration tests.
Advantages of Spring
We can use all of Spring’s functionality in any JEE server, and most of it also in non-managed environments. A central focus of Spring is to allow for reusable business and data access objects that are not tied to specific JEE services. Such objects can be reused across JEE environments (web or EJB), standalone applications, test environments, etc without any hassle.
Spring’s layered architecture gives us a lot of flexibility. All its functionality builds on lower levels. So we can e.g. use the JavaBeans configuration management without using the MVC framework or Aspect-oriented programming (AOP) support. But if we use the web MVC framework or AOP support, we will find they build on the core Spring configuration, so we can apply our knowledge about it immediately.