Book Image

Mockito for Spring

By : Sujoy Acharya
Book Image

Mockito for Spring

By: Sujoy Acharya

Overview of this book

Table of Contents (12 chapters)
Mockito for Spring
About the Author
About the Reviewers

Exploring the Spring architecture

Spring Framework is modular, and its features are organized into different modules. This section talks about core Spring modules. The following are the Spring 4 modules:

The core container

The core container holds the backbone of Spring Framework. The following are the submodules in the core container:

  • Core and Beans: These provide the fundamental parts of the framework, including IoC and dependency injection features

  • Context: This is a means to access objects in a framework-style manner that is similar to the JNDI registry

  • Expression Language: This is also known as SpEL; it is an expression language used to query and modify an object graph and evaluate mathematical expressions

The AOP module

AOP is an aspect-oriented programming implementation of Spring. It decouples the business logic from the cross-cutting infrastructure code, such as logging and security.

The instrumentation module

The instrumentation module provides class instrumentation support for the Spring application. Instrumentation exposes container resources through MBean and helps in JMX management.

The messaging module

The messaging module comes with key abstractions from the Spring Integration project such as Message, MessageChannel, and MessageHandler to serve as a foundation for messaging-based applications.

The data access module

The following are the submodules in the data access module:

  • JDBC: This provides a JDBC abstraction layer

  • ORM: This provides integration layers for popular object-relational mapping APIs, including JPA, JDO, Hibernate, and iBATIS

  • OXM: This provides an abstraction layer that supports object/XML mapping implementations for JAXB, Castor, XMLBeans, JiBX, and Xstream

  • JMS: This contains features to produce and consume messages

  • Transactions: This supports programmatic and declarative transaction management

The web layer

The web layer consists of the web, webmvc/servlet, WebSocket, and webmvc-portlet modules:

  • Web: This module provides basic web-oriented integration features such as multipart file upload functionality and initialization of the IoC container using servlet listeners and web-oriented application context. It also contains the web-related parts of Spring's remoting support.

  • Webmvc: This module (also known as the web-servlet module) contains Spring's model-view-controller implementation for web applications. Spring's MVC framework provides a clean separation between the domain model code and web forms and integrates with all the other features of Spring Framework.

  • Portlet: This 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 webmvc module.

  • WebSocket: This module provides APIs for two-way communication between client and server. It is extremely useful when the client and server need to exchange events at high frequency and low latency. Prime candidates include applications in finance, games, collaboration, and so on.

The test module

The test module supports the unit testing and integration testing of Spring components with JUnit or TestNG.

The following figure represents the Spring 4 modules: