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),而是一个对缓 ...
随机推荐
- cogs1713 [POJ2774]很长的信息
cogs1713 [POJ2774]很长的信息 原题链接 题解 把两串拼成A+'%'+B+'$'.跑后缀数组然后相邻两点i,i+1不在同一串里就用ht[i]更新答案. 好裸... Code // It ...
- C#是数据类型
C#又开始了 开始数据类型 用的软件是VS2017 E short 短整型 int 中等整型 long 长整形 string 字符串类型 bool 布尔类型(true/flase) 相当于数 ...
- Maven学习(十六)-----Maven存储库
什么是Maven资源库? 在 Maven 术语里存储库是一个目录,即目录中保存所有项目的 jar 库,插件或任何其他项目特定文件,并可以容易由 Maven 使用. Maven库中有三种类型 local ...
- linux部署MantisBT(一)部署apache
一.部署apache 1.下载apache安装包及依赖包 http://httpd.apache.org/download.cgi#apache24(apache2)http://apr.apache ...
- Linux内核学习笔记(6)-- 进程优先级详解(prio、static_prio、normal_prio、rt_priority)
Linux 中采用了两种不同的优先级范围,一种是 nice 值,一种是实时优先级.在上一篇粗略的说了一下 nice 值和实时优先级,仍有不少疑问,本文来详细说明一下进程优先级.linux 内核版本为 ...
- FPGA选型
工欲善其事必先利其器,开发FPGA的第一步,当然是选择一片符合你设计需求的芯片. 但是芯片种类那么多,老板又要你越省越好,硬件工程师也天天问你到底该用哪块芯片,怎么办? 今天正好可以跟大家聊聊这些问题 ...
- AngularJS学习之数据绑定
既然AngularJS是以数据作为驱动的MVC框架,在上一篇文章中,也介绍了AngularJS如何实现MVC模式的,所有模型里面的数据,都必须经过控制器,才能展示到视图中. 什么是数据绑定 首先来回忆 ...
- Scrum立会报告+燃尽图(十一月十六日总第二十四次):功能开发与设计页面
此作业要求参见:https://edu.cnblogs.com/campus/nenu/2018fall/homework/2384 项目地址:https://git.coding.net/zhang ...
- c# byte转docx
问题情境: docx文件放进resource中,再用程序读出来的时候是二进制数组. 解决办法: public string ByteConvertWord(byte[] data, string fi ...
- 福大软工1816:Beta(4/7)
Beta 冲刺 (1/7) 队名:第三视角 组长博客链接 本次作业链接 团队部分 团队燃尽图 工作情况汇报 张扬(组长) 过去两天完成了哪些任务 文字/口头描述 准备四六级 展示GitHub当日代码/ ...