Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Spring architecture


May 14, 2021 Spring


Table of contents


Architecture

Spring has the potential to be a one-stop point for all enterprise applications, however, Spring is modular, allowing you to pick and choose the modules that work for you without having to introduce the rest. T he following sections provide a detailed description of all the modules available in the Spring framework.

The Spring framework provides approximately 20 modules that can be used according to the requirements of the application.

Spring architecture

The core container

The core container consists of modules such as spring-core, spring-beans, spring-context, spring-context-support, and spring-expression (SpEL, Spring Expression Language, Spring Expression Language) with the following details:

  • The spring-core module provides the basic components of the framework, including IoC and dependency injection capabilities.

  • The spring-beans module provides BeanFactory, a subtle implementation of the factory pattern that removes the need for coded singletons and decouples configuration and dependencies from the actual encoding logic.

  • The context module is built on the core and beans modules and accesses objects in a manner similar to JNDI registration. T he Context module inherits from the bean module and adds features such as internationalization (for example, using resource bundles), event propagation, resource loading, and transparent creation of contexts (for example, through servelet containers). T he Context module also supports Java EE features such as EJB, JMX, and remote calls. face is the focus of the Context module. Spring-context-support provides support for third-party integration into Spring contexts such as caching (EhCache, Guava, JCache), mail (JavaMail), scheduling (CommonJ, Quartz), template engines (Free Marker, Jasper Repors, Velocity), and more.

  • The spring-expression module provides a powerful expression language for querying and working with object diagrams at runtime. It is an extension of the uniform expression language defined in the JSP2.1 specification, supporting set and get property values, property assignments, method calls, access to the contents of array collections and indexes, logical arithmetic operations, naming variables, retrieving objects from spring IoC containers by name, projection, selection, and aggregation of lists.

Their full dependencies are shown in the following image:

Spring architecture

Data access/integration

The data access/integration layers include JDBC, ORM, OXM, JMS, and transaction modules, which are detailed as follows:

(Note: JDBC, Java Data Base Connectivity, ORM, Object Relational Mapping, OXM, Object XML Mapping, JMS, Java Message Service)

  • The JDBC module provides a JDBC abstraction layer that eliminates lengthy JDBC encoding and parsing of database vendor-specific error codes.

  • The ORM module provides integration into popular object relationship mapping APIs, including JPA, JDO, Hibernate, and more. This module allows you to integrate these ORM frameworks with other features of spring, such as transaction management mentioned earlier.

  • OxM modules provide support for OXM implementations such as JAXB, Castor, XML Beans, JiBX, XStream, and more.

  • The JMS module contains the functionality of production and consumption messages. Starting with Spring 4.1, the Spring-messaging module is integrated.

  • The Transaction module supports programmatic and declared transaction management for the implementation of special interface classes and all POJO. (Note: Programmatic transactions need to write their own transaction management methods such as beginTransaction (), commit(), rollback(), etc., declared transactions are handled automatically by spring by annotation or configuration, programmatic transaction granularity is more detailed)

Web

The Web layer consists of the Web, Web-MVC, Web-Socket, and Web-Portlet, the details of which are as follows:

  • Web modules provide basic web-oriented functionality and web-oriented application contexts, such as multipart file uploads, initializing IoC containers with servlet listeners, and more. It also includes http clients and web-related sections of Spring remote calls.

  • The Web-MVC module provides the implementation of Model View Control (MVC) and REST Web Services for web applications. Spring's MVC framework allows domain model code and web forms to be completely separated and integrated with all other features of the Spring framework.

  • The Web-Socket module supports WebSocket-base and provides two ways to communicate between the client and the server in a web application.

  • The Web-Portlet module provides an MVC implementation for the portlet environment and reflects the functionality of the spring-webmvc module.

Other

There are other important modules, such as AOP, Aspects, Instrumentation, Web, and Test Modules, which are detailed as follows:

  • The AOP module provides a aspect-oriented (faceted) programming implementation that allows you to define method interceptors and entry points to decouple code cleanly, so that the code that implements the functionality is completely decoupled. U sing source-level metadata, you can use metadata similar to . Net properties merge behavior information into code in a way that is not.

  • The Aspects module provides integration with AspectJ, a powerful and proven facet-oriented programming (AOP) framework.

  • The Instrumentation module provides support for class instrumentation and the implementation of class loaders in certain application servers.

  • The Messaging module provides support for STOMP to use as a WebSocket sub-protocol in an application. It also supports an annotation programming model that selects and processes STOMP information from WebSocket clients.

  • The Test module supports testing of Spring components with a JUnit or TestNG framework.