Spring 4.x overall architecture

1. Architecture diagram

The spring framework is divided into three layers. The bottom layer is the core layer , including beans, core, context, and expression (spel). The middle layer is the encapsulated J2EE service (enterprise layer) , including aop, aspects, instrument and messaging, and the top layer is the application. The layer consists of two parts, one part is the data layer, including jdbc, orm, oxm and jms, and the two parts are the web layer, including web, webmvc (servlet), websocket and webflux, as shown in the following figure:

The source code modules are as follows:

2. The core container (bottom layer)

The core container includes spring-beans, spring-core, spring-core-coroutines, spring-context, spring-context-indexer, spring-context-support, and spring-expression . The functions are as follows:

spring-beans and spring-core: the framework foundation of spring, including IOC inversion of control function, in which BeanFactory is the realization of factory mode, decoupling bean configuration and dependency from specific programs

spring-context: It is built on the basis of spring-beans and spring-core. Its functions include context creation, internationalization support, event broadcasting, resource loading, etc. ApplicationContext is the focus of spring-context

spring-context-support: Provides support for common third libraries, integrated into spring-context (context), third-party libraries such as caching (ehcache, guava), communication (javamail), scheduling (quartz, commonj), templates ( freemarker, velocity) etc.

spring-expression: Provides a powerful expression language (SPEL) for querying and manipulating object graphs at runtime. This language supports attribute values, attribute parameters, method calls, array content storage, collections and indexes, logic and Arithmetic operations and naming variables, and retrieve objects from spring's control inversion container by name.

Three, J2EE encapsulation layer

The J2EE encapsulation layer includes spring-aop, spring-aspects, spring-instrument and spring-messaging , the functions are as follows:

spring-aop, spring-aspects: spring-aop provides aspect-oriented programming implementation, spring-aspects provides the integration and implementation of aspectj in aop

spring-instrument: Provides class-level tool support and ClassLoader-level implementation for servers

spring-messaging: Provides basic message-based services, such as Message, MessageChannel, MessageHandler, this module is a new module added by spring 4, separated from spring integration

Fourth, the application layer

4.1, data access/integration

Data access/integration includes spring-oxm, spring-orm, spring-jdbc and spring-jms , the functions are as follows:

spring-oxm: Provides an abstraction layer to support the implementation of Object/XML Mapping, such as JAXB, XStream, etc.

spring-orm: Provides an API integration layer for object-relational mapping, such as Hibernate, JPA, etc.

spring-jdbc: Provides a JDBC abstraction layer that does not need to write lengthy JDBC code and parse database vendor-specific error codes. Generally speaking, it provides an sql statement layer.

spring-jms: Provides the function of producing and consuming messages, and is used in conjunction with the spring-messaging module to realize message processing

4.2, web application

The web application includes spring-web, spring-webflux, spring-webmvc and spring-websocket . The functions are as follows:

spring-web: Provides basic web development-oriented integration functions, such as file upload, web development application context initialization IOC container, and also includes HTTP client and web related parts supported by Spring remote access

spring-webmvc: This is the familiar MVC, namely Model-View-Controller, which contains web applications implemented by Rest web services

spring-websockt: Provides socket link services in web applications

spring-webflux: Provides client and server support for reactive HTTP, server push events, and WebSocket

 

 

 

 

 

Guess you like

Origin blog.csdn.net/ywlmsm1224811/article/details/103406821