2.1 Overview of Spring Framework
As mentioned in Introduction Chapter, Spring Framework is a layered or modular architecture. There are around 20 modules and applications need to deploy/use only required modules .
Refer below diagram for categorization
2.2 Spring Core Container
Spring Core container includes below four modules-
- Spring Core- As its name suggests, this module is the core of the spring framework and provides implementation of several features including Inversion of Control (IoC). IoC is also known as Dependency Injection and it allows objects define their dependencies and container then injects those dependencies when it creates the bean. This process is fundamentally the inverse, hence the name Inversion of Control (IoC)
- Spring Beans-module provides the implementation of BeanFactory
- Spring Context – Spring Core and Spring Beans modules are the foundation of the Context (spring-context) module. This module provides the implementation of Application Context which is a mean to access objects in a framework-style manner that is similar to a JNDI registry. Context module inherits its features from the Beans module and adds support for other features like internationalization events propagation etc
- Spring Expression Language- This module is an extension to expression language supported by Java server pages and also represented as SpEL. This modules helps in achieving dynamic behavior.
2.3 Spring Data Access and Integration
Spring Data Access and Integration consists of below five modules-
- Transaction- The transaction module provides supports programmatic and declarative transaction management that provides benefits like
- Consistent programming model across different transaction APIs such as Java Transaction API (JTA), JDBC, Hibernate, Java Persistence API (JPA), and Java Data Objects (JDO).
- Simpler API for programmatic transaction management than complex transaction APIs such as JTA.
- OXM (Object/XML Mapping) -This module provides an abstraction layer that supports Object/XML mapping implementations such as JAXB, XMLBeans, JiBX
- ORM ( Object Relationship Mapping)- this module supports the integration of application with other ORM frameworks like JPA, JDO, and Hibernate.
- JDBC (Java Database Connectivity)- We all have used JDBC somewhere to connect to the database and repetitive code need to be written every time. The module is kind of wrapper on JDBC which eliminates the need to repetitive and unnecessary exception handling overhead
- JMS (Java Messaging Service) -The JMS module (Java Messaging Service) includes features for sending and receiving messages between many clients
2.4 Spring Web
Web layer includes below modules
- Web- The web module provides support for features like file upload , webapplication-context implementation etc.
- Servlet –This module is also known as spring-web-mvc module and provides M V C implementation for web applications.
- Portlet- This module is also known as spring-webmvc-portlet module provides the support for Spring based Portlets
2.5 Test
This module provides support of the unit testing and integration testing with other testing frameworks like JUnit or TestNG.
2.6 AOP (Aspect Oriented Programming)
This module provides an AOP Alliance implementation to provide a way of modularising application logic, so that each module addresses a distinct concern. For example if we want to write a log statement on entry of every method of our application then instead of having logging logic at several places in an application, AOP provides a means of modularising this logic, and applying it to various parts of the application at runtime. This provides a clear Separation of Concerns and need not to be tied with business logic. Spring-aspects module provides integration with AspectJ.