Spring Framework Architecture | 4 Modules of Spring Architecture

FREE Online Courses: Transform Your Career – Enroll for Free!

1. Objective

In our previous article, you got the brief understanding of what is Spring Framework. Now in this article, you will see Spring Framework architecture. Also, you will learn about the various modules in Spring Architecture.

So, let’s begin Spring Framework Architecture.

Spring Framework Architecture | 4 Modules of Spring Architecture

Spring Framework Architecture | 4 Modules of Spring Architecture

2. Spring Framework Architecture

The basic idea behind the development of Spring Framework was to make it a one-stop shop where you can integrate and use the modules according to the need of your application. This modularity of Spring is due to the architecture of Spring. There are about 20 modules in the  Spring framework which are being used according to the nature of the application.

Do you know What is Spring IoC Containers?

Below is the architecture diagram of the Spring Framework. There you can see all the modules are being defined over the top of Core container. This layered architecture contains all the necessary module that a developer may require in developing the enterprise application. Also, the developer is free to choose or discard any module that is of need or are not of any use according to its requirement. Due to its modular architecture, the integration of Spring Framework with other frameworks can easily do without much problem.

3. Modules of Spring Architecture

The Spring Framework Architecture contains 4 main modules namely: –

Spring Framework Architecture | 4 Modules of Spring Architecture

4 Modules of Spring Architecture with Diagram

a. Core Container

The Core Container in Spring Architecture contains the Core, Beans, Context, Expression Language.

  • The Core provides features to fundamental parts of the framework. This includes the Ioc as well the Dependency Injection (DI).
  • A sophisticated implementation of factory pattern called BeanFactory, is provided by, Bean module.
  • The Context module uses the base provided by the Core and Beans modules. It has access rights for any objects that define and configure. In Context module, the major point is ApplicationContext interface.
  • In Spring Framework, a powerful language tool for querying is given by Expression Language Module. It also does manipulation of an object graph at run-time execution.

Follow this link to know Spring Expression Language Operators and Variables (SpEL)

b. Data Access/Integration

In this part of Spring Architecture, we are going to discuss OXM, JMS, ORM, Transaction Modules, and JDBC.

  • The JDBC module contains a JDBC-abstraction layer which removes the need for JDBC related coding.
  • The Spring Framework doesn’t have its own ORM implementation. But it offers the integration layers with other popular Object Relational Mapping tools such as iBATIS, Hibernate etc.
  • Spring OXM (Spring Object XML Mappers), a Spring Framework Module. With the help of this module, we can ease the mappings between Java object and XML documents. The module can extend. Hence, it provides integration with various other popular frameworks such as JAXB, Castor, XStream etc.
  • The JMS module or Java Messaging Services is a Spring module used for sending and receiving messages.
  • The Spring Transaction Management module is for coordinating the Java objects transaction. It is also used to unify several transaction management APIs.

c. The Web Container

The Web module in Java Spring contains several frameworks, use to ease the task of developing the web related applications. Various popular MVC frameworks like JSF, Struts etc can integrate with the Web module. The Web layer has various modules such as Web, Web-MVC, Web-Socket, and Web-Portlet which are as follows: –

  • The Web module has features of web-oriented integrations. For example, web-oriented application context, multiple file upload functions and initialization of IoC using a servlet.
  • The Spring Web-MVC module is a Model-View-Controller (MVC) of Spring. It provides the implementation for web applications.
  • The Web-Socket module of Spring Framework provides support for WebSocket. It is bi-direction communication between server side and client side in web related applications.
  • The Web-Portlet Spring module insists on implementing MVC in a portlet environment. The functionality of Web-Portlet is same that of the Web-Socket module of Spring.

DO you know What is the Spring JDBC Framework?

d. Miscellaneous

There are several important modules along with AOP, Aspects Instrumentation, Messaging, and Test.

  • The AOP that is Aspect Oriented Programming is a Spring Framework module. It implements cross-cutting concerns. It can alternatively understand as an interceptor which intercepts some processes like a method which is intercepted by Spring AOP during its execution for adding an extra functionality.
  • The Aspects Spring module is a mature and a powerful AOP framework. Using it Spring AspectJ integration is possible.
  • The Testing module is for providing support to classes for writing integration and unit tests. It uses JUnit or TestNG type frameworks.
  • TestingThe Instrumentation module in Spring Framework is for providing class instrument support. These modules use in various application servers.
  • The Messaging module does configurative registration of message objects for message consumption from message queues.

So, this was all about Spring Framework Architecture. Hope you like our explanation.

4. Conclusion

Hence, in this Spring Architecture Tutorial, we discussed, what is Spring Framework Architecture and the modules used in Spring Framework Architecture. Furthermore, if you have a query, feel free to ask in the comment box.

Related Topic – Spring Bean Scope

For reference

Did you like this article? If Yes, please give DataFlair 5 Stars on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *