fix:fix wrong feign version.

greenwich
Haotian Zhang 1 year ago
parent b3319991b6
commit be732356cc

@ -1,5 +1,3 @@
# Change Log
---
- [fix: fix not load application.yml bug & fix guava version conflict bug.](https://github.com/Tencent/spring-cloud-tencent/pull/286)
- [fix:add junit test in config module.](https://github.com/Tencent/spring-cloud-tencent/pull/288)

@ -5,54 +5,69 @@
[![Contributors](https://img.shields.io/github/contributors/Tencent/spring-cloud-tencent)](https://github.com/Tencent/spring-cloud-tencent/graphs/contributors)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Build Status](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml/badge.svg)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml)
[![Test with Junit](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml/badge.svg?branch=greenwich)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/greenwich/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=greenwich)
[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/Tencent/spring-cloud-tencent.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Tencent/spring-cloud-tencent/context:java)
[English](./README.md) | 简体中文
[English](./README.md) | 简体中文
---
README:
- [介绍](#介绍)
- [如何构建](#如何构建)
- [如何使用](#如何使用)
- [使用示例](#使用示例)
更多文档请查看[Wiki](https://github.com/Tencent/spring-cloud-tencent/wiki)
## 介绍
Spring Cloud Tencent 是腾讯开源的一站式微服务解决方案。
Spring Cloud Tencent 是基于 Spring Cloud SPI 实现的一站式微服务解决方案。通过集成 Spring Cloud
和腾讯中间件,让分布式服务和微服务的开发、测试、发布和运维变得更加简单。
<img src="https://user-images.githubusercontent.com/4991116/170412323-ecaf544c-1d7b-45db-9cf0-591544e50c64.png" width="80%" />
**服务发现和治理**
Spring Cloud Tencent 集成 Spring Cloud 和北极星。北极星是一个支持多语言和多框架的服务发现和治理平台。
Spring Cloud Tencent 实现了Spring Cloud 标准微服务 SPI开发者可以基于 Spring Cloud Tencent 快速开发 Spring Cloud 云原生分布式应用。
- [北极星 Github](https://github.com/polarismesh/polaris)
Spring Cloud Tencent 的核心依托腾讯开源的一站式服务发现与治理平台 [Polaris](https://github.com/polarismesh/polaris),实现各种分布式微服务场景。
Spring Cloud 集成北极星可以解决以下问题:
- [Polaris Github home page](https://github.com/polarismesh/polaris)
- [Polaris official website](https://polarismesh.cn/)
- 服务管理:服务发现、服务发现、健康检查
- 流量控制:可自定义的流量路由、负载均衡、限频限流、访问控制
- 故障容错:服务和接口熔断和降级、实例熔断和切换
- 配置管理:版本管理、灰度发布、动态更新
Spring Cloud Tencent提供的能力包括但不限于
## 如何构建
<img width="1029" alt="image" src="https://user-images.githubusercontent.com/4991116/170412323-ecaf544c-1d7b-45db-9cf0-591544e50c64.png">
运行以下命令进行构建。
- 服务注册和发现
- 动态配置管理
- 服务治理
- 服务限流
- 服务熔断
- 服务路由
- ...
- 标签透传
**Linux and Mac**
## 体验环境
```
./mvnw clean package
```
- 管控台地址: http://14.116.241.63:8080/
- 账号polaris
- 密码polaris
- 控制面地址: `grpc://183.47.111.80:8091`
-
`spring-cloud-tencent-example` 下 example 地址都默认指向了体验服务地址(`grpc://183.47.111.80:8091`),如果您只是体验 Spring Cloud Tencent可直接一键运行任何 example。
## 管控台
**Windows**
<img width="1792" alt="image" src="https://user-images.githubusercontent.com/4991116/163402268-48493802-4555-4b93-8e31-011410f2166b.png">
```
.\mvnw.cmd clean package
```
## 使用指南
## 如何使用
Spring Cloud Tencent 所有组件都已上传到 Maven 中央仓库,只需要引入依赖即可。
> 注意:
>
> 支持Spring Cloud 版本2022.0、2021.0、2020.0、Hoxton。
>
> Spring Cloud Tencent
> 的版本列表可以查看
> [Spring Cloud Tencent 版本管理](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86)
> 。
例如:
```` xml
@ -63,7 +78,7 @@ Spring Cloud Tencent 所有组件都已上传到 Maven 中央仓库,只需要
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number-->
<version>${version}</version>
<version>1.11.4-2021.0.6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -80,32 +95,21 @@ Spring Cloud Tencent 所有组件都已上传到 Maven 中央仓库,只需要
````
- ### 快速开始
- [Spring Cloud Tencent 版本管理](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Version-Management)
- [Spring Cloud Tencent 服务注册与发现](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Discovery-Usage-Documentation)
- [Spring Cloud Tencent 配置中心](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Config-Usage-Documentation)
- [Spring Cloud Tencent 限流](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Rate-Limit-Usage-Document)
- [Spring Cloud Tencent 熔断](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Circuitbreaker-Usage-Document)
- [Spring Cloud Tencent 服务路由](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Router-Usage-Document)
- [Spring Cloud Tencent 标签传递](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Metadata-Transfer-Usage-Document)
## 使用示例
- ### 开发文档
- [项目概览](https://github.com/Tencent/spring-cloud-tencent/wiki/%E9%A1%B9%E7%9B%AE%E6%A6%82%E8%A7%88)
- [参与共建](https://github.com/Tencent/spring-cloud-tencent/wiki/Contributing)
北极星为开发者提供体验环境:
## 交流群
- [北极星控制台](http://119.91.66.223:80)
- 北极星服务端地址:`grpc://119.91.66.223:8091`
扫描下面的二维码加入 Spring Cloud Tencent 交流群
在 spring-cloud-tencent-example 项目里,北极星服务端地址默认配置为`grpc://119.91.66.223:8091`。
<img src="https://user-images.githubusercontent.com/24446200/169198148-d4cc3494-3485-4515-9897-c8cb5504f706.png" width="30%" height="30%" />
## 交流群
扫码二维码,加入 Spring Cloud Tencent 交流群。欢迎用户反馈使用问题和优化建议。
## License
The spring-cloud-tencent is licensed under the BSD 3-Clause License. Copyright and license information can be found in the file [LICENSE](LICENSE)
<img src="https://user-images.githubusercontent.com/24446200/169198148-d4cc3494-3485-4515-9897-c8cb5504f706.png" width="20%" height="20%" />
## Stargazers over time
如果您对 Spring Cloud Tencent 有兴趣,请关注我们的项目~
[![Stargazers over time](https://starchart.cc/Tencent/spring-cloud-tencent.svg)](https://starchart.cc/Tencent/spring-cloud-tencent)
[![](https://starchart.cc/Tencent/spring-cloud-tencent.svg)](https://starchart.cc/Tencent/spring-cloud-tencent)

@ -5,53 +5,70 @@
[![Contributors](https://img.shields.io/github/contributors/Tencent/spring-cloud-tencent)](https://github.com/Tencent/spring-cloud-tencent/graphs/contributors)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Build Status](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml/badge.svg)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml)
[![Test with Junit](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml/badge.svg?branch=greenwich)](https://github.com/Tencent/spring-cloud-tencent/actions/workflows/junit_test.yml)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/greenwich/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=greenwich)
[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/Tencent/spring-cloud-tencent.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Tencent/spring-cloud-tencent/context:java)
English | [简体中文](./README-zh.md)
README:
- [Introduction](#introduction)
- [How to build](#how-to-build)
- [How to use](#how-to-use)
- [Examples](#examples)
Visit [Wiki](https://github.com/Tencent/spring-cloud-tencent/wiki) to learn more
## Introduction
Spring Cloud Tencent is a open source one-stop microservice solution from Tencent.
Spring Cloud Tencent is an one-stop microservice solution which implements the standard Spring Cloud SPI. It integrates
Spring Cloud with Tencent middlewares and makes it easy to develop microservice.
Spring Cloud Tencent implements the Spring Cloud standard microservice SPI, so developers can quickly develop Spring Cloud cloud-native distributed applications based on Spring Cloud Tencent.
<img src="https://user-images.githubusercontent.com/4991116/170412596-692f8dae-42f7-495f-a451-01396e381eb0.png" width="80%" />
The core of Spring Cloud Tencent relies on Tencent's open-source one-stop service discovery and governance platform [Polaris](https://github.com/polarismesh/polaris) to realize various distributed microservice scenarios.
**Service discovery and governance**
- [Polaris Github home page](https://github.com/polarismesh/polaris)
- [Polaris official website](https://polarismesh.cn/)
Spring Cloud Tencent integrates Spring Cloud with Polaris which is an open source system for service discovery and
governance.
The capabilities provided by Spring Cloud Tencent include but are not limited to:
- [Polaris Github](https://github.com/polarismesh/polaris)
<img width="1031" alt="image" src="https://user-images.githubusercontent.com/4991116/170412596-692f8dae-42f7-495f-a451-01396e381eb0.png">
Spring Cloud with Polaris can solve these problem:
- Service registration and discovery
- Dynamic configuration management
- Service Governance
- Service rate limit
- Service circuit breaker
- Service routing
- ...
- Label transparent transmission
- service management: service discovery, service registry and health check
- traffic control: customizable routing, load balance, rate limiting and access control
- fault tolerance: circuit breaker for service, interface and instance
- config management: config version control, grayscale release and dynamic update
## Demo Environment
## How to build
- Console Address : http://14.116.241.63:8080/
- Username: polaris
- Password: polaris
- Server Address: `grpc://183.47.111.80:8091`
Run these commands to build this project as follow.
The example addresses under `spring-cloud-tencent-example` all point to the experience service address (`grpc://183.47.111.80:8091`) by default.
If you only experience Spring Cloud Tencent, you can run any example directly with one click.
**Linux and Mac**
## Screenshots
```
./mvnw clean package
```
<img width="1792" alt="image" src="https://user-images.githubusercontent.com/4991116/163402268-48493802-4555-4b93-8e31-011410f2166b.png">
**Windows**
## Use Guide
```
.\mvnw.cmd clean package
```
All the components of Spring Cloud Tencent have been uploaded to the Maven central repository, just need to introduce dependencies.
## How to use
All the components of Spring Cloud Tencent have been uploaded to the Maven central repository, just need to introduce
dependencies.
> Notice:
>
> Support Spring Cloud 2022.0, 2021.0, 2020.0, Hoxton.
>
> The version list of Spring Cloud Tencent can be found
> in
> [Spring Cloud Tencent Version Management](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-%E7%89%88%E6%9C%AC%E7%AE%A1%E7%90%86)
> .
For example:
@ -63,7 +80,7 @@ For example:
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number-->
<version>${version}</version>
<version>1.11.4-2021.0.6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -80,28 +97,20 @@ For example:
````
- ### Quick Start
- [Spring Cloud Tencent Version Management](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Version-Management)
- [Spring Cloud Tencent Discovery](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Discovery-Usage-Documentation)
- [Spring Cloud Tencent Config](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Config-Usage-Documentation)
- [Spring Cloud Tencent Rate Limit](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Rate-Limit-Usage-Document)
- [Spring Cloud Tencent CircuitBreaker](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Circuitbreaker-Usage-Document)
- [Spring Cloud Tencent Router](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Router-Usage-Document)
- [Spring Cloud Tencent Metadata Transfer](https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Metadata-Transfer-Usage-Document)
- ### Development Documentation
- [Project Structure Overview](https://github.com/Tencent/spring-cloud-tencent/wiki/%E9%A1%B9%E7%9B%AE%E6%A6%82%E8%A7%88)
- [Participate in co-construction](https://github.com/Tencent/spring-cloud-tencent/wiki/Contributing)
## Chat Group
## Examples
Please scan the QR code to join the chat group.
The experience environment of Polaris is provided for developers:
- [Polaris Console](http://119.91.66.223:80)
- Polaris Server Address: `grpc://119.91.66.223:8091`
<img src="https://user-images.githubusercontent.com/24446200/169198148-d4cc3494-3485-4515-9897-c8cb5504f706.png" width="30%" height="30%" />
The address of Polaris server in spring-cloud-tencent-example is `grpc://119.91.66.223:8091` by default.
## License
The spring-cloud-tencent is licensed under the BSD 3-Clause License. Copyright and license information can be found in the file [LICENSE](LICENSE)
## Chat Group
Please scan the QR code to join the chat group.
<img src="https://user-images.githubusercontent.com/24446200/169198148-d4cc3494-3485-4515-9897-c8cb5504f706.png" width="20%" height="20%" />
## Stargazers over time

@ -0,0 +1,5 @@
# Change Log
---
- [fix: fix not load application.yml bug & fix guava version conflict bug.](https://github.com/Tencent/spring-cloud-tencent/pull/286)
- [fix:add junit test in config module.](https://github.com/Tencent/spring-cloud-tencent/pull/288)

@ -86,7 +86,7 @@
<properties>
<!-- Project revision -->
<revision>1.5.4-Greenwich.SR6</revision>
<revision>1.5.5-Greenwich.SR6</revision>
<!-- Spring Cloud -->
<spring.cloud.version>Greenwich.SR6</spring.cloud.version>

@ -34,6 +34,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.tencent.cloud.common.constant.MetadataConstant.HeaderName.PEER_SERVICE;
import static feign.Util.checkNotNull;
/**
@ -82,20 +83,25 @@ public class PolarisFeignClient implements Client {
ServiceCallResult resultRequest = new ServiceCallResult();
resultRequest.setNamespace(MetadataContext.LOCAL_NAMESPACE);
String serviceName = request.requestTemplate().feignTarget().name();
resultRequest.setService(serviceName);
URI uri = URI.create(request.url());
resultRequest.setMethod(uri.getPath());
resultRequest.setRetStatus(RetStatus.RetSuccess);
String sourceNamespace = MetadataContext.LOCAL_NAMESPACE;
String sourceService = MetadataContext.LOCAL_SERVICE;
if (StringUtils.isNotBlank(sourceNamespace) && StringUtils.isNotBlank(sourceService)) {
resultRequest.setCallerService(new ServiceKey(sourceNamespace, sourceService));
}
resultRequest.setHost(uri.getHost());
resultRequest.setPort(uri.getPort());
Object[] headers = request.headers().get(PEER_SERVICE).toArray();
int headersLength = headers.length;
if (headersLength != 0) {
String serviceName = (String) headers[headersLength - 1];
resultRequest.setService(serviceName);
URI uri = URI.create(request.url());
resultRequest.setMethod(uri.getPath());
resultRequest.setRetStatus(RetStatus.RetSuccess);
String sourceNamespace = MetadataContext.LOCAL_NAMESPACE;
String sourceService = MetadataContext.LOCAL_SERVICE;
if (StringUtils.isNotBlank(sourceNamespace) && StringUtils.isNotBlank(sourceService)) {
resultRequest.setCallerService(new ServiceKey(sourceNamespace, sourceService));
}
resultRequest.setHost(uri.getHost());
resultRequest.setPort(uri.getPort());
return resultRequest;
return resultRequest;
}
return null;
}
}

@ -17,12 +17,23 @@
package com.tencent.cloud.polaris.circuitbreaker.feign;
import java.io.IOException;
import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import feign.Client;
import feign.Request;
import feign.Response;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import static com.tencent.cloud.common.constant.MetadataConstant.HeaderName.PEER_SERVICE;
/**
* Wrap for {@link LoadBalancerFeignClient}.
*
@ -35,4 +46,12 @@ public class PolarisLoadBalancerFeignClient extends LoadBalancerFeignClient {
SpringClientFactory clientFactory) {
super(delegate, lbClientFactory, clientFactory);
}
@Override
public Response execute(Request request, Request.Options options) throws IOException {
Map<String, Collection<String>> headers = new HashMap<>(request.headers());
headers.put(PEER_SERVICE, Collections.singletonList(URI.create(request.url()).getAuthority()));
request = Request.create(request.httpMethod(), request.url(), headers, request.requestBody());
return super.execute(request, options);
}
}

@ -70,14 +70,13 @@
</developers>
<properties>
<revision>1.5.4-Greenwich.SR6</revision>
<revision>1.5.5-Greenwich.SR6</revision>
<polaris.version>1.6.2</polaris.version>
<!-- Dependencies -->
<logback.version>1.2.7</logback.version>
<guava.version>23.0</guava.version>
<consul.version>1.4.5</consul.version>
<openfeign.version>2.2.6.RELEASE</openfeign.version>
<mocktio.version>4.5.1</mocktio.version>
<byte-buddy.version>1.12.10</byte-buddy.version>
<guava.version>31.0.1-jre</guava.version>
@ -97,14 +96,6 @@
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
<version>${openfeign.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.ecwid.consul</groupId>
<artifactId>consul-api</artifactId>

@ -5,7 +5,7 @@ spring:
name: polaris-circuitbreaker-example-a
cloud:
polaris:
address: grpc://183.47.111.80:8091
address: grpc://9.135.8.246:8091
namespace: default
enabled: true
circuitbreaker:

@ -5,7 +5,7 @@ spring:
name: polaris-circuitbreaker-example-b
cloud:
polaris:
address: grpc://183.47.111.80:8091
address: grpc://9.135.8.246:8091
namespace: default
enabled: true
is-throw-runtime-exception: false

Loading…
Cancel
Save