Spring (a) opening

1, Spring Introduction

In the early J2EE era, developing an application very tedious, they will not speak to create and manage objects, such as other database access, provide Web services so we need to spend a lot of time. At that time an Australian named Rod Johnson took the lead on this J2EE framework bloated, inefficient status quo various questioned, after Rod write "Expert one on one J2EE design and development" a book Johnson, set forth by the part of the concept and prototype created the Spring Framework. (PS: Rod Johnson is actually a doctor of music ???)

Spring Framework is a lightweight open source Java framework, mainly to address the complexity of enterprise application development and creation. Its core is to help us manage objects and their dependencies, but also provided as general logging, performance statistics, security control, exception handling aspect-oriented capabilities, but also integrates a large number of third-party frameworks, such as database access framework Hibernate, mybatis, Web services framework Struts, provide their own SpringMVC, as well as task scheduling, Redis cache, Mq and so on.

Spring Framework is also committed to solutions for J2EE application layers, in the presentation layer, the business layer and persistence layer corresponding functions are integrated framework, it can be said that enterprise application development Spring "one-stop" solution.

But in fact the opposite is not J2EE and Spring, Spring is a J2EE supplement, which will integrate J2EE specification of each:

Spring can be said to be "borrowed" stone hills, to the progressive realization of their ecosystem.

2, the evolution of the Spring Framework

Spring first version released in October 2002, has ten years, all aspects of the core functions, such as Spring Community Support Framework are developing rapidly, it is necessary to recall the important features of the Spring each milestone release brings.

  • Spring 0.9: This is the framework for the first public release to "Expert One-on-One: J2EE Design and Development" based on a book, provides the basis for bean configuration, AOP support, JDBC abstraction framework, abstract transaction support Wait. This version has no official reference document, but you can find the source code and documentation available on SourceForge.
  • Spring 1.x: This is the first version with the official reference document published. It consists of seven modules.
    • Spring Core、Spring Context、Spring DAO、Spring ORM、Spring AOP、Spring Web、Spring Web MVC
  • Spring 2.x: This version consists of six modules, Spring Context Spring Core modules into the middle, Spring Web MVC into the Spring Web in.
    • @AspectJ annotation support AOP development.
    • Full support for asynchronous JMS message-driven POJO.
    • Task scheduling introduced TaskExecutor abstract.
    • Java 5 annotation support, especially @ Transactional, @ Required and @AspectJ.
  • Spring 2.5.x: This version contains the following features.
    • New @Autowired comment and support for JSR-250 annotations (@ Resource, @ PostConstruct and @PreDestroy) of.
    • New registration Bean related notes: @Component, @ Repository, @ Service and @Controller.
    • In addition to Spring MVC @Controller notes, also added @ RequestMapping, @ RequestParam and @ModelAttribute notes to support the request processing configuration through annotations.
  • Spring 3.0.x: This is based on the first version of Java Spring 5, Java5 designed to take advantage of features such as generics, variable parameters.
    • Java5 support features such as generics, variable parameters.
    • Full support for REST.
    • The new MVC XML namespaces and other annotations, such as @CookieValue and @RequessHeaders SpringMVC in.
    • Verify enhancements and JSR-303 (Bean validation) support.
  • Spring 3.2.x: This version contains the following features.
    • Support request process based on asynchronous Servlet 3.0.
    • The new SpringMVC comment @ControllerAdvice.
  • Spring 4.x: This is an important release of Spring, it is also the first version to fully support Java 8. Although you can still use the older version, but deprecated classes and methods has been deleted.
    • Full support for Hibernate ORM 5.0.
    • JMS and Web improvements.
    • Improvement WebSocket messaging.
    • Introduced AopTestUtils utility class that allows access to the underlying object Spring agents.
  • Spring 5.x: This is a major release, the entire framework is based on Java 8.
    • Take full advantage of the power of Java 8, resulting in significant improvements in performance.
    • Support JMS2.0 + and JPA 2.1+.
    • Introduced Spring Web Flux, which is a project to replace SpringMVC, built on the basis of the reaction formula, it is completely asynchronous and non-blocking.
    • Web and core modules are suitable for reactive programming model.

3, Spring overall architecture

To Spring 5.0 times, about which the module 20, as shown:

image

These modules are summarized in the following sections.

Core Container

Core Container (core container) comprising Core, Beans, Context and Expression Language four modules.

  • Core mold tools must mainly containing core Spring Framework is the basic core of the other components. The dynamic proxy related asm, cglib, and various Utils, StringUtils, CollectionUtils.
  • Beans module contains an access profile, create and manage bean as well as IoC / DI all operations associated with the class. Such as: BeanFactory, BeanDefinitions and so on.
  • Context module is built on the basis of Core and Beans modules, which inherited the properties of Beans, Spring provides a number of extensions to the core. ApplicationContext interface Context is the core module.
  • Expression Language module provides a powerful expression language. EL expression is used in a JSP ancient times.

Data Access/Integration

Data Access / Integration comprising JDBC, ORM, OXM, JMS and Transaction module.

  • JDBC module provides a JDBC abstraction layer used to adapt all the database vendors. This module contains all classes Spring data access on JDBC package.
  • ORM 模块提供了几种常用的对象关系映射框架,如 JPA 、Hibernate 、iBatis 。
  • OXM 模块提供了一个对ObjecνXML 映射实现的抽象层。
  • JMS (Java Messaging Service)模块主要包含一些生产和消费消息的特性。
  • Transaction 模块支持编程和声明性的事务管理。

Web

Web 层包含了Web 、Servlet 、WebSocket、Porlet 模块。

  • Web 模块:提供了基础的面向Web 的集成特性。例如,多文件上传。
  • Servlet 模块:该模块包含Spring 的model-view-controller (MVC)实现。
  • WebSocket 模块:提供 WebSocket 协议支持。
  • Porlet 模块:提供了用于 Portlet 环境和 Servlet 模块的 MVC 的实现

AOP

AOP 模块提供了一个符合 AOP 联盟标准的面向切面编程实现,它让你可以定义例如方法拦截器和切点,从而将逻辑代码分开,降低它们之间的耦合性。

  • Aspects 模块提供了对AspectJ 的集成支持。
  • Instrumentation 模块提供了class instrumentation 支持和classloader 实现,使得可以在特定的应用服务器上使用。
  • Messaging 模块:对消息通信集成提供了广泛的支持,及提供简化 JMS API 的使用到异步接收消息的完整基础结构。

Test

Test 模块支持使用 JUnit 和TestNG 对 Spring 组件进行测试。

最后

Spring 背景及架构就介绍到这,接下来将对 Spring 核心容器、AOP、事务这三部分内容展开一系列的讨论。

注:该系列文章使用的 Spring 版本是 5.0+。



以上就是本章内容,如果文章中有错误或者需要补充的请及时提出,本人感激不尽。

参考:

"Spring source depth analysis (second edition)"
"Spring5 Advanced Programming"
"SpringBoot programming ideas"
https://baike.baidu.com/item/spring/85061#2
https://docs.spring.io/spring/ docs / 5.2.2.RELEASE / spring-framework- reference / overview.html # overview

Guess you like

Origin www.cnblogs.com/loongk/p/12194690.html