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),而是一个对缓 ...
随机推荐
- linux设置定时任务调用接口
1.设置目录 cd /var/spool/cron 2.编辑文件(当前登录用户,不一定是root) vim root 3.添加内容 0 0 * * * wget http://192.144.141. ...
- 对posintion属性的简单认识,对于还在纠结的同学们,有一定的帮助
position的四个属性值: relative ,absolute ,fixed,static 下面分别讲述这四个属性,以简单代码表示 <div id="parent" ...
- 怎样安装Scrapy
Windows怎样安装Scrapy? pip install scrapy会报错 访问https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 下载并放到 ...
- Phaser3跟随自定义路径移动的赛车 -- iFIERO游戏教程
racingcar 在线预览:http://www.ifiero.com/uploads/phaser/pathrotate/代码: var config = { type: Phaser.AUT ...
- 人脸辨识,用树莓派Raspberry Pi实现舵机云台追踪脸孔
影像辨识作为近年最热门的专业技术之一,广泛用于智慧监视器.车电监控.智慧工厂.生物医疗电子等等:其中,人脸辨识是一个很重要的部分,网络上已经有相当多的资源可供下载使用:于是我们使用舵机云台作为镜头旋转 ...
- 《More Effective C++ 》读书笔记(二)Exception 异常
这事篇读书笔记,只记录自己的理解和总结,一般情况不对其举例子具体说明,因为那正是书本身做的事情,我的笔记作为梳理和复习之用,划重点.我推荐学C++的人都好好读一遍Effective C++ 系列,真是 ...
- Atom 插件 Sync Settings 备份与恢复
当使用 Atom IDEA.随着使用的越来越多,安装的插件也越来越多,一旦电脑重装后需要复原开发环境,这将是一件比较头疼的事.「Sync Settings」插件可以帮助我们解决这个问题. 操作流程 安 ...
- JAVA学习笔记--字符串概述
一.String类 String类代表字符串,是由字符构成的一个序列.创建String对象的方法很简单,有以下几种: 1)用new来创建: String s1 = new String("m ...
- Tree - Gradient Boosting Machine with sklearn source code
This is the second post in Boosting algorithm. In the previous post, we go through the earliest Boos ...
- Python基础灬文件常用操作
文件常用操作 文件内建函数和方法 open() :打开文件 read():输入 readline():输入一行 seek():文件内移动 write():输出 close():关闭文件 写文件writ ...