Spring architecture is modular. Spring provides about 20 different modules like AOP, Spring MVC, Spring JDBC, Spring ORM, Spring Bean and many more. Although spring provides different modules, we can select the desired module according to application need.
Spring module
mainly contains Data Access / Integration, Web (MVC/Remoting), Core Container,
AOP, Aspect, Instrumentation and Messaging.
Below is the
spring architecture diagram.
Below is the description
of these modules in spring
Core Container
Core container consists
of four modules Bean, Core, Context, SpEL. Let us discuss them:
1.
Bean
– Bean module
provides the implementation of factory pattern with the help of BeanFactory.
2.
Core
– this module is responsible
for providing the fundamental part of the module which includes IoC and DI (Dependency
Injection) features.
3.
Context
– context module
is dependent on Bean and Core module which provides it with a solid base. Context
module is the medium by which we can access any defined configured object. The ApplicationContext
interface is the main part of the Context module.
4.
SpEL
– this module is
known as Special Expression Language. It is responsible to provide effective
Expression Language for querying and manipulating an object graph
Data Access/Integration –
This layer is responsible
for Data layer integration and accesses the database with the desirable
technique. It consists of JDBC, ORM, OXM, JMS, Transaction. Let us
discuss them.
1.
JDBC – Spring provides grate support to JDBC templates.
This module helps the spring application to connect with JDBC database seamlessly.
This JDBC module removes the boilerplate code which was required to connect
with JDBC.
2.
ORM – Spring module provides an integration layer so that
spring application can be integrated with appropriate ORM tool. Using this
module, we can connect with ORMs like Hibernate, JPA, JDO, iBatis.
3.
OXM – with OXM module spring implements an abstract layer
that supports JAXB, Castor, XMLBeans, JiBX and XStream using Object/XML mapping
implementations.
4.
JMS – This module is known as the Java Messaging Service.
This module helps in producing and consuming messages.
5.
Transaction
– this module comes
handy when dealing with transaction management. It provides extensive support
to both programmatic as well as declarative transaction management.
Web –
The spring web
module provides different implementations which help the user to build client server-based
application. This module includes web, WebSocket, Servlet, Portlet. Let us
discuss them:
1.
Web – web module provides web integration features like
initializing IoC container using servlet listener and a web-oriented
application context.
2.
Web-MVC – this module helps to implement a web-based application
with Model View and Controller.
3.
Web-Portlet
- The Web-Portlet
provides MVC implementation to use in a portal environment and reflects the functionality of the Web-Servlet.
4.
Web-Socket
– this module helps
in building the communication between client-server is a web-based application.
Others –
1.
Aspect – aspect module helps to integrate the powerful
and developed AOP module.
2.
AOP – AOP stands for Aspect-Oriented Programming. This module helps us to
write aspects which we can use when we want to define pointcuts and method
interceptors. This module helps to decouple the code with is separate from
other functionalities.
3.
Instrumentation – this module provides
support to ClassLoader implementations and class instrumentation which can be used in certain
application servers.
4.
Messaging – this module provides
support to Simple Text Oriented Messaging Protocol(STOMP). STOMP can be used as WebSocket
sub-protocol to be used in the application.
5.
Test – Test module provides support to automated application
testing using Junit or TestNG framework.
That is all about
the spring framework architecture. The next topic which we have to learn is
Spring Tutorial -Environmental Setup. Stay tuned.
0 Comments