就在1月23日,spring的官方博客发布了Spring Cloud Greenwich版本正式发版的消息,Greenwich版本目前已经上了Maven的中央仓库,现在来看看Greenwich有哪些变化。

End of Life (EOL) 提醒

Edgware版本将于2019年8月1日达到EOL状态。您可以在此处阅读正式公告。

Spring Cloud Finchley发布系列目前是一个主要版本,并且与Spring Boot 2.0.x版本相关联。 因此,当Spring Boot 2.0.x版本分支标记为EOL时,Spring Cloud Finchley版本系列将达到EOL状态。

Spring Cloud Greenwich版本系列被认为是次要版本,并将继续支持Spring Boot 2.x版本分支。

Greenwich有哪些新变化

Spring Cloud所有的项目都进行了更新,以实现Java 11的兼容性。并且Greenwich 版本有两个新项目,Spring Cloud GCP(提供与Google Cloud Platform的集成)和Spring Cloud Kubernetes(提供与Kubernetes的集成)。

Spring Cloud Netflix项目进入维护模式

最近,Netflix宣布Hystrix正在进入维护模式(不再添加新功能,只修复bug)。 自2016年以来,Ribbon已处于类似状态。虽然Hystrix和Ribbon现在处于维护模式,但它们仍然在Netflix上大规模部署。

Hystrix Dashboard和Turbine已被Atlas取代。以下Spring Cloud Netflix模块将进入维护模式:

  • spring-cloud-netflix-archaius
  • spring-cloud-netflix-hystrix-contract
  • spring-cloud-netflix-hystrix-dashboard
  • spring-cloud-netflix-hystrix-stream
  • spring-cloud-netflix-hystrix
  • spring-cloud-netflix-ribbon
  • spring-cloud-netflix-turbine-stream
  • spring-cloud-netflix-turbine
  • spring-cloud-netflix-zuul

这不包括Eureka或并发限制模块。

替代组件

不过不用慌张,虽然netflix绝大部分组件已经进入维护模式,但是Spring Cloud团队开发了一些新的组件去取代这些组件。

当前组件

可取代的组件

Hystrix

Resilience4j

Hystrix Dashboard / Turbine

Micrometer + Monitoring System

Ribbon

Spring Cloud Loadbalancer

Zuul 1

Spring Cloud Gateway

Archaius 1

Spring Boot external config + Spring Cloud Config

下面来看一下Greenwich版本的主要变化。

Spring Cloud Sleuth

  • 更新到了最新的Brave库。
  • WebFlux和Reactor集成的性能改进。
  • 增加了GRPC组件
  • 增加了对多个span reporter 支持。
  • 增加了限速采样器的支持。

Spring Cloud GCP

See the Google release announcement.

Spring Cloud Netflix

  • 升级了Ribbon and Eureka 的版本
  • 为新的ServiceInstance.instanceId字段添加了支持。

Spring Cloud Consul

  • 为新的ServiceInstance.instanceId字段添加了支持。

Spring Cloud Gateway

  • 添加了重写响应头过滤器。
  • 在各自的路由predict中为多个路径和主机添加了支持,并自定义在某些情况下返回的HTTP状态代码。

Spring Cloud Kubernetes

  • 你现在可以将ServiceInstance元数据配置为来自Kubernetes Labels对象、Annotations对象和Ports对象。
  • 在启动期间使用KubernetesDiscoveryClient进行了增强。
  • 添加了一个模块来检测Istio的存在。

Spring Cloud Security

添加了Spring Cloud Gateway 的一个过滤器去支持 OAuth2。具体可参考这个案例。https://github.com/spring-cloud-samples/sample-gateway-oauth2login

Spring Cloud Config

添加了EnvironmentRepository以支持CredHub后端。

Spring Cloud OpenFeign

  • 支持了@QueryMap注解
  • 升级到了OpenFeign版本为10.1.0.

其他升级的组件比如Spring Cloud Commons、Spring Cloud 、VaultSpring Cloud Contract、Spring Cloud Task、Spring Cloud Zookeeper、Spring Cloud Stream、Spring Cloud Function见原文:https://spring.io/blog/2019/01/23/spring-cloud-greenwich-release-is-now-available

以下模块作为Greenwich.RELEASE版本进行了更新:

模块

版本

Spring Cloud Sleuth

2.1.0.RELEASE (issues)

Spring Cloud Gcp

1.1.0.RELEASE (issues)

Spring Cloud Build

2.1.2.RELEASE

Spring Cloud Netflix

2.1.0.RELEASE (issues)

Spring Cloud Consul

2.1.0.RELEASE

Spring Cloud Gateway

2.1.0.RELEASE (issues)

Spring Cloud

Greenwich.RELEASE

Spring Cloud Function

2.0.0.RELEASE (issues)

Spring Cloud Stream

Fishtown.RELEASE

Spring Cloud Zookeeper

2.1.0.RELEASE

Spring Cloud Cloudfoundry

2.1.0.RELEASE

Spring Cloud Aws

2.1.0.RELEASE

Spring Cloud Task

2.1.0.RELEASE

Spring Cloud Kubernetes

1.0.0.RELEASE (issues)

Spring Cloud Contract

2.1.0.RELEASE (issues)

Spring Cloud Release

Greenwich.RELEASE

Spring Cloud Security

2.1.0.RELEASE

Spring Cloud Starter

Greenwich.RELEASE

Spring Cloud Bus

2.1.0.RELEASE (issues)

Spring Cloud Config

2.1.0.RELEASE (issues)

Spring Cloud Vault

2.1.0.RELEASE (issues)

Spring Cloud Openfeign

2.1.0.RELEASE (issues)

Spring Cloud Commons

2.1.0.RELEASE

Spring Cloud Dependencies

2.1.2.RELEASE

Spring Cloud Finchely版本发布才半年多,Greenwich版本就发布了,预计2019年7月将会发布H版本了,有得学了,大家加油。

注:本文部分参考spring官方博客https://spring.io/blog/2019/01/23/spring-cloud-greenwich-release-is-now-available