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
Spring Cloud Greenwich 新特性和F升级分享的更多相关文章
- 【Finchley】【新特性】Spring Cloud Finchley 新特性
Finchley 正式版的发布貌似经历了相当长的时间,这次的重大发布主要带来了以下 4 项重大更新. 重大更新 1.新增 Spring Cloud Gateway 组件 Spring Cloud Ga ...
- Spring Cloud Greenwich 正式发布,Hystrix 即将寿终正寝。。
Spring Cloud Greenwich 正式版在 01/23/2019 这天正式发布了,下面我们来看下有哪些更新内容. 生命周期终止提醒 Spring Cloud Edgware Edgware ...
- Spring Cloud Greenwich.SR4 发布了,跟不上了……
前几天 Spring Cloud Greenwich.SR4 发布了: https://spring.io/blog/2019/11/19/spring-cloud-greenwich-sr4-rel ...
- 我这样回答了Spring 5的新特性,面试官对我刮目相看
最近,有一个小伙伴拿到了自己满意的Offer,和他交谈的过程中得知他面试官问他关于Spring的问题比较多,其中最让面试官满意的就是自己回答关于Spring 5的知识点回答的不错. Spring5于2 ...
- Spring cloud Greenwich Eureka
1.父工程POM文件中: <dependencyManagement> <dependencies> <!--spring cloud--> <depende ...
- 关于Spring Cloud的核心特性
SOA和微服务的区别 其实服务化架构已经可以解决大部分企业的需求了,那么我们为什么要研究微服务呢?先说说它们的区别: 微服务架构强调业务系统需要彻底的组件化和服务化,一个组件就是一个产品,可以独立对外 ...
- 1. Spring Cloud Greenwich SR2 概览
Spring Cloud provides tools for developers to quickly build some of the common patterns in distribut ...
- Exadata 18.1新特性--计算节点升级增强
新的计算节点升级增强能大幅缩短升级花费的时间,最快能减少40%的时间,具体的增强主要体现在以下方面: 1.计算节点操作系统的备份工作. 以前计算节点操作系统的备份工作是在正式升级之前执行,在滚动升级过 ...
- Spring 3.1新特性之三:Spring对声明式缓存的支持
一.概述: Spring 3.1 引入了激动人心的基于注释(annotation)的缓存(cache)技术,它本质上不是一个具体的缓存实现方案(例如EHCache 或者 OSCache),而是一个对缓 ...
随机推荐
- SQL基本的45题
-- 查询Student表中的所有记录的Sname.Ssex和Class列.SELECT Sname,Ssex,Class from student -- 查询教师所有的单位即不重复的Depart列. ...
- javaweb(三十八)——mysql事务和锁InnoDB(扩展)
MySQL/InnoDB的加锁分析,一直是一个比较困难的话题.我在工作过程中,经常会有同事咨询这方面的问题.同时,微博上也经常会收到MySQL锁相关的私信,让我帮助解决一些死锁的问题.本文,准备就My ...
- leetcode- 将有序数组转换为二叉搜索树(java)
将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树. 本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1. 示例: 给定有序数组: [-10,-3,0, ...
- Docker虚拟机172.17网段冲突,导致网络访问问题
在虚拟机中安装docker,linux ubuntu16 ,安装完公司172.17网段被docker0覆盖,导致ssh无法连接到ubuntu. 经过官网的这篇build your own bridge ...
- 第七次ScrumMeeting博客
第七次ScrumMeeting博客 本次会议于11月1日(三)22时整在3公寓725房间召开,持续15分钟. 与会人员:刘畅.辛德泰.窦鑫泽.张安澜.赵奕.方科栋. 1. 每个人的工作(有Issue的 ...
- USACO 1.3.4 Prime Cryptarithm 牛式(模拟枚举)
Description 下面是一个乘法竖式,如果用我们给定的那n个数字来取代*,可以使式子成立的话,我们就叫这个式子牛式. * * * x * * ------- * * * * * * ------ ...
- 王者荣耀交流协会-小组互评Alpha版本
小组分工如下: 1.探路者---贪吃蛇(测评人:王玉玲) 链接:http://www.cnblogs.com/WYLFZ/p/7805520.html http://www.cnblogs.co ...
- 福大软工1816 ·软工之404NoteFound团队选题报告
目录 NABCD分析引用 N(Need,需求): A(Approach,做法): B(Benefit,好处): C(Competitors,竞争): D(Delivery,交付): 初期 中期 个人贡 ...
- 技术博客HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...
- Java 异常总结
Throwablede类是 Java 语言中所有错误或异常的超类. 两个子类的实例,Error 和 Exception Error 是 Throwablede 的子类,用于指示合理的应用程序不应该试图 ...