Overview-Spring

Spring资料

https://en.wikipedia.org/wiki/Spring_Framework

https://docs.spring.io/spring/docs/

Spring 系列文章

Spring理念

https://docs.spring.io/spring/docs/current/spring-framework-reference/overview.html#overview-philosophy

Design Philosophy

When you learn about a framework, it’s important to know not only what it does but what principles it follows. Here are the guiding principles of the Spring Framework:

  • Provide choice at every level. Spring lets you defer design decisions as late as possible. For example, you can switch persistence providers through configuration without changing your code. The same is true for many other infrastructure concerns and integration with third-party APIs.
  • Accommodate diverse perspectives. Spring embraces flexibility and is not opinionated about how things should be done. It supports a wide range of application needs with different perspectives.
  • Maintain strong backward compatibility. Spring’s evolution has been carefully managed to force few breaking changes between versions. Spring supports a carefully chosen range of JDK versions and third-party libraries to facilitate maintenance of applications and libraries that depend on Spring.
  • Care about API design. The Spring team puts a lot of thought and time into making APIs that are intuitive and that hold up across many versions and many years.
  • Set high standards for code quality. The Spring Framework puts a strong emphasis on meaningful, current, and accurate javadoc. It is one of very few projects that can claim clean code structure with no circular dependencies between packages.

Spring Framework Module

Show a picture (从spring 4.3.x中扒的,因为spring5的找不到这个module图了)

https://docs.spring.io/spring-framework/docs/4.3.x/spring-framework-reference/html/overview.html#overview-modules

image-20200124120638018

Spring 发展史

下面讲spring分成几个阶段

发展历程

开端 J2EE

j2ee存在的问题

​ applications are often slow, unduly complex, and take too long to develop.Rod Johnson believes that the problem lies not in J2EE itself, but in that it is often used badly(使用问题)

​ 2002-10 Rod Johnson 写了 Expert One-on-One J2EE Design and Development

​ 在这 本书中 讲解了何时使用EJB(需要分布式事务和消息的时候使用) 以及J2EE走向何方,写了interface21包 来简化J2EE的开发,提出了using a Framework to Configure Application Components ,

用 javaBeans、 BeanFactory、applictionContext (简化、参考ejb)来简化J2EE开发,

以及如何简化EJB的使用 ,通过抽象EJB的 Bean,将使用EJB的代码与依赖JNDI和EJB API的代码分离。

​ 同年, 开源了interface21, 并改名为 spring

​ 2003 年6月 发布 spring0.9

​ 2004-3 发布 spring 1.0 XML Bean Definitions

​ Spring MVC

​ spring 1.2 支持注解,要求jdk1.5

​ 粘合剂 把Struts,Hibernate等黏合到一起,史称SSH。

繁琐的EJB

​ In early 2004, Martin Fowler asked the readers of his site: when talking about Inversion of Control: “the question is, what aspect of control are [they] inverting?”

​ Inversion of Control / Dependency Injection

​ 2004-6 Rod Johnson等写了 J2EE Development without EJB(讨论了我们真正需要EJB的什么,如何同样实现这些功能, 我们曾经在无数的书籍和文章中看到,EJB是J2EE的核心技术之一,EJB太繁琐,约束太多,依赖EJB容器,轻量级j2ee)

​ 2005-7 Professional Java Development with the Spring Framework

注解时代

​ 基于注解的依赖注入和组件扫描 @Autowise @Configurable

​ 2006年发布 Spring 2.0

​ Ruby on Rails的框架突然崛起,约定重于配置,Don’t repeat yourself的思想随着RoR深入人心。

​ 2007年发布 Spring 2.5 。

​ 2009年Spring 3.0 注解的进一步完善, RESTful的支持

配置简化

​ xml配置繁琐,自动装配springboot, 微服务等兴起

​ 2013年12月 Spring4.0 支持jdk8

​ 2014 Spring Boot 约定大于配置

​ 2015 Spring Cloud

反应式编程

​ 解决了什么问题?为什么需要?

​ 高并发,IO密集型应用,同步阻塞的模型,受连接池等约束,反应式编程 reactive stream

​ 2017年9月 Spring 5.0 WebFlux

版本特征

Version Date Notes
0.9 2002
1.0 2003
2.0 2006
3.0 2009
4.0 2013
5.0 2017

​ The first version was written by Rod Johnson, who released the framework with the publication of his book Expert One-on-One J2EE Design and Development in October 2002.

The framework was first released under the Apache 2.0 license in June 2003.

The first milestone release, 1.0, was released in March 2004 with further milestone releases in September 2004 and March 2005.

The Spring 1.2.6 framework won a Jolt productivity award and a JAX (Java API for XML) Innovation Award in 2006.[2][3]

Spring 2.0 was released in October 2006,

Spring 2.5 in November 2007,

Spring 3.0 in December 2009,

Spring 3.1 in December 2011, and Spring 3.2.5 in November 2013.[4]

Spring Framework 4.0 was released in December 2013.[5]

Notable improvements in Spring 4.0 included support for Java SE (Standard Edition) 8, Groovy 2, some aspects of Java EE 7, and WebSocket.

Spring Framework 4.2.0 was released on 31 July 2015 and was immediately upgraded to version 4.2.1, which was released on 01 Sept 2015.[6] It is “compatible with Java 6, 7 and 8, with a focus on core refinements and modern web capabilities”.[7]

Spring Framework 4.3 has been released on 10 June 2016 and will be supported until 2020.[8] It “will be the final generation within the general Spring 4 system requirements (Java 6+, Servlet 2.5+), […]”.[9]

Spring 5 is announced to be built upon Reactive Streams compatible Reactor Core.[10]

Bean发展史

客户端

​ java, 一开始的目标是客户端应用

javaBeans

《javaBeans规范》

  1. 这个类需要是public 的, 然后需要有个无参数的构造函数
  2. 这个类的属性应该是private 的, 通过setXXX()和getXXX()来访问
  3. 这个类需要能支持“事件”, 例如addXXXXListener(XXXEvent e), 事件可以是Click事件,Keyboard事件等等, 当然咱们也支持自定义的事件。
  4. 我们得提供一个所谓的自省/反射机制, 这样能在运行时查看java bean 的各种信息“
  5. 这个类应该是可以序列化的, 即可以把bean的状态保存的硬盘上, 以便以后来恢复。

Model

​ MVC(Model-View-Controller)中的model

​ ->struct

​ ->spring

Enterprise Java bean

J2EE

​ 1998年发表 JDK1.2 并分为标准版(Standard Edition,J2SE), 企业版(Enterprise Edition,J2EE),微型版(MicroEdition,J2ME)。J2EE便由此诞生。

​ 四层模型

​ 客户层组件 :运行在客户端机器上的客户层组件

​ session bean

​ web层组件 :运行在J2EE服务器上,java Servlet和JavaServer Pages(JSP)是web层组件

​ entity Bean

​ 业务层组件: 运行在J2EE服务器上,Enterprise JavaBeans(EJB)是业务层组件.

​ message-driven beans.

​ 信息系统层 : EIS服务器上的企业信息系统(Enterprise information system)层软件

J2EE 粘合剂:EJB

​ EJB(Enterprise JavaBean) 是J2EE的一种规范。设计目标与核心应用是部署分布式应用程序。

​ EJB 1.0 (1998-03-24)

​ EJB 2.0, final release (2001-08-22)

​ EJB 3.0, final release (2006-05-11)

​ JDBC

​ JNDI

​ RMI

​ JMS

​ JTA

​ Java mail

​ 部署、集群

POJO

​ POJO(Plain Ordinary Java Object)即POJO是一个简单的普通的Java对象,它不包含业务逻辑或持久逻辑等,但不是JavaBean、EntityBean等,不具有任何特殊角色和不继承或不实现任何其它Java框架的类或接口。(是MartinFowler等发明的一个术语)

Spring的文档中有这样一句话

 Spring enables you to build applications from "plain old Java objects" (POJOs) and to apply enterprise services non-invasively to POJOs. This capability applies to the Java SE programming model and to full and partial Java EE.

转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 951488791@qq.com

文章标题:Overview-Spring

字数:1.6k

本文作者:zhengyumin

发布时间:2019-03-02, 12:29:06

最后更新:2020-01-27, 11:28:24

原始链接:http://zyumin.github.io/2019/03/02/Overview_Spring/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。