Spring is based on Rod Johnson's "Expert One-on-one development and Design". The main goal is to reduce the complexity of enterprise applications by using basic JavaBean to accomplish things that were previously only done with EJBS. This series of source learning is based on the Spring-4.3.11 version.
I. The overall architecture of spring
, spring can be summed up in a few parts:
(1) Core Container
The core container for spring, which contains the Beans,core,context and Spel modules.
The core and beans modules are the fundamental parts of the framework, providing (IoC) control inversion and dependency injection characteristics. where beans function in spring is like object to OOP, without object concept there is no object-oriented programming, there is no bean in spring without the meaning of spring. Spring allows the object's self-built dependencies to be managed by the configuration file, which is the spring dependency injection mechanism. This injection relationship is managed in a container called IOC, the context. In order to better understand the relationship between the three bean,core,context. The bean can be understood as an actor in a performance, the context is the background of the performance, and the core is the performance of props, used to find, build and maintain the relationship between each bean a series of tools required. From this point of view, it is easier to understand the core components called Util.
The Spring-expression module provides a powerful expression language for querying and manipulating objects at run-time. He is an extension of the UNIFED expression language defined in the JSP2.1 specification. The language supports setting, getting property values, assigning attributes, invoking methods, accessing the array context (accessing the context of arrays), containers and indexers, logical and arithmetic operators, named variables, and spring's IOC container to retrieve objects by name. He also supports list projection, selection, and general list aggregation.
(2) AOP and instrumentation
AOP provides a facet-oriented programming implementation that conforms to the AOP Federation standard, allowing you to define, for example, method interceptors and pointcuts, to separate logical code and reduce the coupling between them. Using the Source-level metadata feature, you can also combine information from various behaviors into your code, similar to. The Attibute concept in net technology.
The Apsects module provides integrated support for the ASPECTJ.
The instrumentation module provides class instrumentation support and ClassLoader implementations that can be used on specific application servers.
(3) Messaging
The Spring Framework 4 framework contains a Spring-message module that contains, for example, messages, Messagechannel, MessageHandler, and other key abstractions from the Spring integration project. Provides the foundation for message-based applications. The module also includes a set of annotations that map messages to methods, similar to the spring-based programming model of MVC annotations.
(4) Data access/integration
The Data access/integration layer package contains JDBC, ORM, OXM, JMS, and transaction modules.
The A.JDBC module provides a JDBC abstraction layer that eliminates lengthy JDBC coding and parses the library vendor-specific error code. This module contains all of the classes that spring encapsulates for JDBC data access.
The B.SPRING-TX (Transaction) module supports programmatic and declarative transaction management, which must implement a specific interface and be used for all pojo.
The C.orm module provides an interactive layer for popular object-relational mapping APIs such as Jpa,jdo,hibernate. With the ORM package, you can mix the O/R mappings with all of the spring-provided features. As mentioned earlier, the simple
Declarative transaction management.
The D.OXM module provides an abstraction layer for the implementation of the Object/xml mapping, including JAXB, Castor, XMLBeans, Jibx, and XStream for the object/xml mapping implementation.
The E.JMS module mainly contains some of the characteristics of manufacturing and consuming messages.
(5) Web
The Web layer contains spring-web
, spring-webmvc
,, spring-websocket
and spring-webmvc-portlet
modules.
Web modules: Provides basic web-oriented integration features such as multi-file uploads, initializing IOC containers with servlet listeners, and a web-oriented application context. It also contains an HTTP client and related parts of the web in spring remote support.
WEBMVC module: Also known as a Web servlet module, contains spring's Model View Controller (MVC) and Web applications implemented by other Web services. The Spring MVC Framework provides a clean separation between domain model code and Web Forms, and integrates all the other features of the spring framework.
(6) Test
The test module supports testing of spring components using JUnit and testng. It provides a consistent spring application context and cache loading. It also provides mock-up objects that can be used to isolate the test code.
Spring Source Learning (1)--spring overall architecture and design philosophy