Spring source Interpretation (a): Spring background and origins of the overall framework introduced

I. Introduction

Spring originated in 2002 Rod Johnson wrote a book, "Expert One-on-One J2EE", the book introduces the Java enterprise application development situation, and pointed out that Java EE EJB component framework and some of the major flaws have also been proposed a simpler solution based more regular Java classes and dependency injection. In the book, he shows how to build without the use of EJB high-quality, scalable online seat reservation system. For building applications, he wrote more than 30,000 lines of code infrastructure, the root package project named com.interface21, this is Spring's predecessor, the original name framework called interface21.

In 2003 Rod Johnson and his companions on the basis of this framework to develop a new framework named Spring, according to Rod Johnson introduced a new beginning Spring is the traditional J2EE, Spring followed by development into the fast lane.

Two, Spring 5.x of modules

Spring Framework functionality modules consists of about 20 composition. These modules are divided into core container, data access / integration, Web, AOP (aspect-oriented programming), the Instrumentation, messaging and test, as shown in FIG.

1, Spring core container by the Core-Spring , Spring-Beans, Spring-context, context-Support-Spring, and-expression The Spring (the Spring Expression Language) module.

spring-core and spring-beans module provides base frame member, including IOC and dependency injection characteristics.

上下文(spring-context)模块建立在core和beans模块基础之上的。context模块从beans模块继承其功能,并添加对国际化(例如,使用资源包),事件传播,资源加载以及通过,例如Servlet容器透明创建上下文的支持,还支持Java EE功能,例如EJB,JMX和基本远程处理。spring-context-support 提供对将常见的第三方库集成到Spring应用程序上下文中的支持,特别是对于缓存(EhCache,JCache)和调度(CommonJ,Quartz)。

spring-expression模块提供了一种功能强大的表达式语言,用于在运行时查询和操作对象图。它是JSP 2.1规范中指定的统一表达式语言(统一EL)的扩展。该语言支持设置和获取属性值,属性赋值,方法调用,访问数组,集合和索引器的内容,逻辑和算术运算符,命名变量以及从Spring的IoC容器中按名称检索对象。它还支持列表投影和选择以及常用列表聚合。

spring-aop模块提供了一个符合AOP Alliance标准的面向方面的编程实现,允许您定义,例如,方法拦截器和切入点,以干净地解耦实现应该分离的功能的代码。使用源级元数据功能,您还可以以类似于.NET属性的方式将行为信息合并到代码中。

单独的spring-aspects模块提供与AspectJ的集成。

spring-instrument模块提供了在某些应用程序服务器中使用的类检测支持和类加载器实现。

spring-messaging从关键抽象模块 Spring集成项目,例如Message,MessageChannel,MessageHandler,和其他人作为基于消息的应用奠定了基础。

 

2、数据访问/集成层由JDBC,ORM,OXM,JMS和事务模块组成。

spring-jdbc模块提供了一个JDBC抽象层,无需进行繁琐的JDBC编码和解析数据库供应商特定的错误代码。

spring-tx模块支持对实现特殊接口的类和所有POJO的类进行编程和声明式事务管理。

spring-orm模块为流行的对象关系映射API提供了集成层,包括JPA和Hibernate。使用spring-orm模块,您可以将这些O / R映射框架与Spring提供的所有其他功能结合使用,例如前面提到的简单声明式事务管理功能。

spring-oxm模块提供了一个抽象层,支持对象/ XML映射实现,如JAXB,Castor,JiBX和XStream。

spring-jms模块(Java Messaging Service)包含用于生成和使用消息的功能。 从Spring Framework 4.1开始,它提供了与spring-messaging模块的集成。

 

3、Web层由spring-web,spring-webmvc和spring-websocket模块组成。

spring-web模块提供基本的面向Web的集成功能,例如多部分文件上载功能以及使用Servlet侦听器和面向Web的应用程序上下文初始化IoC容器。 它还包含一个HTTP客户端以及Spring的远程支持的Web相关部分。

spring-webmvc模块(也称为Web-Servlet模块)包含Spring的模型 - 视图 - 控制器(MVC)和用于Web应用程序的REST Web服务实现。 Spring的MVC框架提供了域模型代码和Web表单之间的清晰分离,并与Spring Framework的所有其他功能集成在一起。

4、Spring测试模块支持使用JUnit或TestNG对Spring组件进行单元测试和集成测试。 它提供Spring ApplicationContexts的一致加载和这些上下文的缓存。 它还提供了可用于独立测试代码的模拟对象。

 

使用场景:

1、典型的完整Spring Web应用程序

2、使用第三方Web框架的Spring中间层

3、Remoting使用场景

4、EJB - 包装现有的POJO

 

以上说明来源于Spring官方文档。

以下是SpringFramework的所有模块:

 

Guess you like

Origin www.cnblogs.com/magic-sea/p/11256467.html