Spring Cloud Greenwich 新特性和F升级分享

  2019.01.23 期待已久的Spring Cloud Greenwich 发布了release版本,作为我们团队也第一时间把RC版本替换为release,以下为总结,希望对你使用Spring Cloud Greenwich 有所帮助 Greenwich 只支持 Spring Boot 2.1.x 分支。如果使用 2.0.x 请使用Finchley版本,
  
  pom坐标
  
  主要是适配JAVA11
  
  <!--支持Spring Boot 2.1.X-->
  
  <dependency>
  
  <groupId>org.springframework.boot</groupId>
  
  <artifactId>spring-boot-dependencies</artifactId>
  
  <version>2.1.2.RELEASE</version>
  
  <type>pom</type>
  
  <scope>import</scope>
  
  </dependency>
  
  <!--Greenwich.RELEASE-->
  
  <dependency>
  
  <groupId>org.springframework.cloud</groupId>
  
  <artifactId>spring-cloud-dependencies< www.ysyl157.com /artifactId>
  
  <version>Greenwich.RELEASE</version>
  
  <type>pom</type>
  
  <scope>import</scope>
  
  </dependency>
  
  升级netflix版本,DiscoveryClient支持获取InstanceId
  
  image
  
  Spring Cloud Config 提供了新的存储介质
  
  除了Git、File、JDBC,新版本提供 在Cloud Foundry的CredHub存储功能
  
  spring:
  
  profiles:
  
  active: credhub
  
  cloud:
  
  config:
  
  server:
  
  credhub:
  
  url: https://credhub:8844
  
  Spring Cloud Gateway
  
  支持整合OAuth2
  
  这里提供了一个例子: Spring Cloud Gateway and Spring Security OAuth2
  
  整合的时候有个坑可以参考这个issue:ReactiveManagementWebSecurityAutoConfiguration Prevent‘s oauth2Login from being defaulted
  
  新增重写响应头过滤器
  
  spring:
  
  cloud:
  
  gateway:
  
  routes:
  
  - id: rewriteresponseheader_route
  
  uri: http://www.hengda157.com example.org
  
  filters:
  
  - RewriteResponseHeader=X-Response-Foo,www.dasheng178.com , password=[^&]+, password=***
  
  Feign 的新特性和坑
  
  @SpringQueryMap 对Get请求进行了增强
  
  终于解决这个问题了
  
  不用直接使用OpenFeign新增的@QueryMap,由于缺少value属性 QueryMap注释与Spring不兼容...
  
  异常解决
  
  对Spring Cloud Finchley 进行直接升级时候发现feign启动报错了
  
  ***************************
  
  APPLICATION FAILED TO START
  
  ***************************
  
  Description:
  
  The bean ‘pigx-upms-biz.FeignClientSpecification‘, defined in null, could not be registered. A bean with that name has already been defined in null and www.wanchuang2.com overriding is disabled.
  
  Action:
  
  Consider renaming one of the beans or enabling overriding by setting spring.main.www.lezongyule.com allow-bean-definition-overriding=true
  
  Process finished with exit code 1
  
  第一种粗暴的解决方法,异常日志中说明了,在 bootstrap.yml中配置
  
  spring.main.allow-bean-definition-overriding=true
  
  这是Spring Boot 2.1 后新增的属性运行bean 覆盖,不要配置到配置中心里面,不然无效
  
  第二种,就是把通过同一个服务调用的代码,移动到同一个@FeignClient中
  
  contextId ,这个是@FeignClient 新增的一个属性
  
  This will be used as the bean name instead of name if present, but will not be used as a service id.
  
  就可以用这个属性区分@FeigenClient 标志的同一个service 的接口
  
  总结
  
  Spring Cloud F -- > G 变化很小,微乎其微主要是JAVA11的兼容
  
  很遗憾没有看到 Spring Cloud Alibaba 加油。
  
  Spring Cloud LoadBalancer 还是老样子。目前来看暂时无法替代 ribbon
  

原文地址:https://www.cnblogs.com/qwangxiao/p/10317124.html

时间: 2024-08-29 06:10:50

Spring Cloud Greenwich 新特性和F升级分享的相关文章

【新特性】Spring Cloud Finchley 新特性

Finchley 正式版的发布貌似经历了相当长的时间,这次的重大发布主要带来了以下 4 项重大更新. 重大更新 1.新增 Spring Cloud Gateway 组件 Spring Cloud Gateway 是一个基于 Spring Webflux 和响应式 Netty 的下一代 API 网关,用来替换 Spring Cloud Netflix Zuul.它提供了更加简单的动态路由,以及针对每个路由的过滤器(如地址重写.断路器.添加/删除请求头.限流和安全等). 2.新增 Spring Cl

关于Spring Cloud的核心特性

SOA和微服务的区别 其实服务化架构已经可以解决大部分企业的需求了,那么我们为什么要研究微服务呢?先说说它们的区别: 微服务架构强调业务系统需要彻底的组件化和服务化,一个组件就是一个产品,可以独立对外提供服务 微服务不再强调传统SOA架构里面比较重的ESB企业服务总线 微服务强调每个微服务都有自己独立的运行空间,包括数据库资源. 微服务架构本身来源于互联网的思路,因此组件对外发布的服务强调了采用HTTP Rest API的方式来进行 微服务的切分粒度会更小 总结:微服务架构是 SOA 架构思想的

Spring cloud Greenwich Eureka

1.父工程POM文件中: <dependencyManagement> <dependencies> <!--spring cloud--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Greenwich.RE

java版spring cloud+spring boot 社交电子商务平台-关于Spring Cloud的核心特性

SOA和微服务的区别 其实服务化架构已经可以解决大部分企业的需求了,那么我们为什么要研究微服务呢?先说说它们的区别:微服务架构强调业务系统需要彻底的组件化和服务化,一个组件就是一个产品,可以独立对外提供服务微服务不再强调传统SOA架构里面比较重的ESB企业服务总线微服务强调每个微服务都有自己独立的运行空间,包括数据库资源.微服务架构本身来源于互联网的思路,因此组件对外发布的服务强调了采用HTTP Rest API的方式来进行微服务的切分粒度会更小总结:微服务架构是 SOA 架构思想的一种扩展,更

Spring -- 4.0新特性 -- 泛型依赖注入

泛型依赖注入为spring4.0版本新增加的特性. 目录结构 BaseService.java类 public class BaseService<T> { @Autowired private BaseRespository baseRespository; public void save() { System.out.println("Base Class save method"); System.out.println(baseRespository); } }

济南中心JavaEE框架:spring五——spring4新特性

%E9%BB%91%E9%A9%AC%E7%A8%8B%E5%BA%8F%E5%91%98%E6%B5%8E%E5%8D%97hibernate%E7%9A%84%E4%B8%80%E7%BA%A7%E7%BC%93%E5%AD%98%E5%92%8C%E4%BA%8C%E7%BA%A7%E7%BC%93%E5%AD%98 http://auto.315che.com/yujun/qa24078015.htm http://auto.315che.com/dazhongcc/qa24205074

java9新特性-20-Javascript引擎升级:Nashorn

1.官方Feature 236: Parser API for Nashorn 292: Implement Selected ECMAScript 6 Features in Nashorn 2.使用说明 Nashorn 项目在 JDK 9 中得到改进,它为 Java 提供轻量级的 Javascript 运行时.Nashorn 项目跟随 Netscape 的 Rhino 项目,目的是为了在 Java 中实现一个高性能但轻量级的 Javascript 运行时.Nashorn 项目使得 Java

Atitit spring 3.0 3.1 3.2 4.0 4.3 5.0 新特性

Spring3.0的新特性及其分析 - 我的人生不甘于平庸! - ITeye技术网站.html Spring3.0带来的新特性 - 未来之路 - 博客频道 - CSDN.NET.html Spring 3.1 新特性一览表 - 开源中国社区.html Spring 3.2三个值得关注的新特性 - 51CTO.COM.html Spring 4.3 的新功能和增强 - ImportNew.html Spring 4.x框架中的新特性---Spring4.0框架的新功能和改善 - FireOfSta

介绍一下Spring Cloud微服务架构的核心特性

Spring Cloud作为一套微服务治理的框架,几乎考虑到了微服务治理的方方面面,之前也写过一些关于Spring Cloud文章,主要偏重各组件的使用,本次分享主要解答这两个问题:Spring Cloud在微服务的架构中都做了哪些事情?Spring Cloud提供的这些功能对微服务的架构提供了怎样的便利? 传统架构发展史 单体架构 单体架构在小微企业比较常见,典型代表就是一个应用.一个数据库.一个web容器就可以跑起来,比如我们开发的开源软件云收藏,就是标准的单体架构. 在两种情况下可能会选择