feat:support Spring Cloud 2022.0.

pull/838/head
Haotian Zhang 1 year ago
parent beebcecb50
commit 83b9decd3a

@ -0,0 +1,28 @@
name: Codecov 2022.0
on:
push:
branches:
- 2022.0
pull_request:
branches:
- 2022.0
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout codes
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Test with Maven
run: mvn -B test --file pom.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ${{ github.workspace }}/target/site/jacoco/jacoco.xml

@ -0,0 +1,39 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Test with Junit 2022.0
on:
push:
branches:
- 2022.0
pull_request:
branches:
- 2022.0
jobs:
build:
strategy:
matrix:
java: [ 17 ]
os: [ 'windows-latest', 'ubuntu-latest' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout codes
uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Test with Maven
run: mvn -B test --file pom.xml

@ -1,32 +1,2 @@
# Change Log
---
- [Optimize:optimize SpringValueProcessor.](https://github.com/Tencent/spring-cloud-tencent/pull/655)
- [Optimize/optimize annotation.](https://github.com/Tencent/spring-cloud-tencent/pull/672)
- [Optimize: Register the service with the ProviderAPI#registerInstance method.](https://github.com/Tencent/spring-cloud-tencent/pull/686)
- [docs:update PR template.](https://github.com/Tencent/spring-cloud-tencent/pull/690)
- [enhancement: revert default value when the field is deleted in @ConfigurationProperties bean](https://github.com/Tencent/spring-cloud-tencent/issues/681)
- [Feature:support multi register and discovery both to nacos and polaris.](https://github.com/Tencent/spring-cloud-tencent/pull/693)
- [Code optimize & add junit tests.](https://github.com/Tencent/spring-cloud-tencent/pull/701)
- [Optimize: remote deprecated method](https://github.com/Tencent/spring-cloud-tencent/pull/697)
- [Test:support environment variable metadata test](https://github.com/Tencent/spring-cloud-tencent/pull/698)
- [Test: remote deprecated method in test](https://github.com/Tencent/spring-cloud-tencent/pull/706)
- [upgrade protobuf-java.version to 3.21.7](https://github.com/Tencent/spring-cloud-tencent/pull/715)
- [docs:update README.](https://github.com/Tencent/spring-cloud-tencent/pull/718)
- [Fix:fix javadoc.](https://github.com/Tencent/spring-cloud-tencent/pull/721)
- [Code optimization & correct comment](https://github.com/Tencent/spring-cloud-tencent/pull/722)
- [fix:fix discovery junit.](https://github.com/Tencent/spring-cloud-tencent/pull/730)
- [Test:add sct-stater-polaris-router juint.](https://github.com/Tencent/spring-cloud-tencent/pull/731)
- [adapt polaris-java 1.10.1 version](https://github.com/Tencent/spring-cloud-tencent/pull/746)
- [Optimize: change RouteArgument.buildCustom to RouteArgument.fromLabel](https://github.com/Tencent/spring-cloud-tencent/pull/749)
- [Optimize: get service instances by Flux.blockLast() to resolve concurrent problem](https://github.com/Tencent/spring-cloud-tencent/pull/764)
- [Fix issue: prompt no registration if web dependence was not imported.](https://github.com/Tencent/spring-cloud-tencent/pull/772)
- [Bugfix: fix reactor concurrent bug when get instances & fix spring-retry fuse not working bug](https://github.com/Tencent/spring-cloud-tencent/pull/774)
- [Standardize the name of method to create bean.](https://github.com/Tencent/spring-cloud-tencent/pull/779)
- [set reporter.enabled default to true](https://github.com/Tencent/spring-cloud-tencent/pull/784)
- [fix:fix nacos enabled condition bugs.](https://github.com/Tencent/spring-cloud-tencent/pull/793)
- [fix:fix instance's weight hard code to 100 bug.](https://github.com/Tencent/spring-cloud-tencent/pull/802)
- [feat:update getPort method of PolarisRegistration.](https://github.com/Tencent/spring-cloud-tencent/pull/803)
- [fix:fix some compile output issues.](https://github.com/Tencent/spring-cloud-tencent/pull/814)
- [Feature: upgrade framework version.](https://github.com/Tencent/spring-cloud-tencent/pull/815)
- [fix:nacos & polaris discovery](https://github.com/Tencent/spring-cloud-tencent/pull/816)

@ -1,4 +1,4 @@
<img src="https://github.com/Tencent/spring-cloud-tencent/raw/2021.0/doc/logo/rectangle-white.png" width="60%" height="60%" alt="Spring-Cloud-Tencent-Logo"/>
<img src="https://github.com/Tencent/spring-cloud-tencent/raw/2022.0/doc/logo/rectangle-white.png" width="60%" height="60%" alt="Spring-Cloud-Tencent-Logo"/>
[![Wiki](https://badgen.net/badge/icon/wiki?icon=wiki&label)](https://github.com/Tencent/spring-cloud-tencent/wiki)
[![Maven Central](https://img.shields.io/maven-central/v/com.tencent.cloud/spring-cloud-tencent?label=Maven%20Central)](https://search.maven.org/search?q=g:com.tencent.cloud%20AND%20a:spring-cloud-tencent)
@ -6,7 +6,7 @@
[![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)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/2021.0/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=2021.0)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/2022.0/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=2022.0)
[English](./README.md) | 简体中文
@ -79,7 +79,7 @@ Spring Cloud Tencent 所有组件都已上传到 Maven 中央仓库,只需要
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number-->
<version>1.8.3-2021.0.3</version>
<version>1.8.5-2022.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -128,4 +128,3 @@ the file [LICENSE](LICENSE)
如果您对 Spring Cloud Tencent 有兴趣,请关注我们的项目~
[![Stargazers over time](https://starchart.cc/Tencent/spring-cloud-tencent.svg)](https://starchart.cc/Tencent/spring-cloud-tencent)

@ -1,4 +1,4 @@
<img src="https://github.com/Tencent/spring-cloud-tencent/raw/2021.0/doc/logo/rectangle-white.png" width="60%" height="60%" alt="Spring-Cloud-Tencent-Logo"/>
<img src="https://github.com/Tencent/spring-cloud-tencent/raw/2022.0/doc/logo/rectangle-white.png" width="60%" height="60%" alt="Spring-Cloud-Tencent-Logo"/>
[![Wiki](https://badgen.net/badge/icon/wiki?icon=wiki&label)](https://github.com/Tencent/spring-cloud-tencent/wiki)
@ -7,7 +7,7 @@
[![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)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/2021.0/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=2021.0)
[![codecov.io](https://codecov.io/gh/Tencent/spring-cloud-tencent/branch/2022.0/graph/badge.svg)](https://codecov.io/gh/Tencent/spring-cloud-tencent?branch=2022.0)
English | [简体中文](./README-zh.md)
@ -76,7 +76,7 @@ For example:
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<!--version number-->
<version>1.8.3-2021.0.3</version>
<version>1.8.5-2022.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>

@ -1,4 +0,0 @@
# Change Log
---
- [Upgrade spring boot version with 2.6.x and spring cloud version with 3.1.x](https://github.com/Tencent/spring-cloud-tencent/pull/195)

@ -1,5 +0,0 @@
# Change Log
---
- [Add metadata transfer example.](https://github.com/Tencent/spring-cloud-tencent/pull/211)
- [feat:merge features from 1.5.x-Hoxton.SR9.](https://github.com/Tencent/spring-cloud-tencent/pull/250)

@ -1,4 +0,0 @@
# Change Log
---
- [fix not load application.yml bug & fix guava version conflict bug](https://github.com/Tencent/spring-cloud-tencent/pull/289)

@ -1,32 +0,0 @@
# Change Log
---
- [Upgrade: fix third-party lib CVEs & upgrade core spring libs version](https://github.com/Tencent/spring-cloud-tencent/pull/263)
- [feat:support reading configuration from application.yml or application.properties.](https://github.com/Tencent/spring-cloud-tencent/pull/262)
- [fix:fix ClassNotFoundException while not importing openfeign when using circuit-breaker module.](https://github.com/Tencent/spring-cloud-tencent/pull/271)
- [fix:solve ratelimit-callee-service UnknownHostException.](https://github.com/Tencent/spring-cloud-tencent/pull/292)
- [Feature: Add config change listener feature support](https://github.com/Tencent/spring-cloud-tencent/pull/299)
- [Feature: Add config module unit test](https://github.com/Tencent/spring-cloud-tencent/pull/301)
- [Feature:add restTemplate Report Polaris](https://github.com/Tencent/spring-cloud-tencent/pull/304)
- [Update GitHub Actions workflow](https://github.com/Tencent/spring-cloud-tencent/pull/305)
- [fix: use non-blocking call instead of blocking call](https://github.com/Tencent/spring-cloud-tencent/pull/309)
- [solve the chaos code problem on rejectTips in 2021.0](https://github.com/Tencent/spring-cloud-tencent/pull/315)
- [Fix config file format misspell](https://github.com/Tencent/spring-cloud-tencent/pull/321)
- [Feature: Add instance metadata spi for registration](https://github.com/Tencent/spring-cloud-tencent/pull/324)
- [Improve: Improve code style & Upgrade spring boot version with 2.6.9](https://github.com/Tencent/spring-cloud-tencent/pull/322)
- [Feature: add spring cloud tencent logo](https://github.com/Tencent/spring-cloud-tencent/pull/332)
- [UT: add metadata-transfer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/335)
- [feat:Add GitHub action of codecov.yml and update junit of metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/344)
- [Feature: optimize static metadata manager](https://github.com/Tencent/spring-cloud-tencent/pull/346)
- [fix: shutdown thread pool before the container closes](https://github.com/Tencent/spring-cloud-tencent/pull/355)
- [rm code: Condition 'null != interceptors' is always 'true' ](https://github.com/Tencent/spring-cloud-tencent/pull/357)
- [docs:update logo in README.](https://github.com/Tencent/spring-cloud-tencent/pull/360)
- [Use jdk constants instead of magic variables](https://github.com/Tencent/spring-cloud-tencent/pull/361)
- [Refator JacksonUtils and JacksonUtilsTest](https://github.com/Tencent/spring-cloud-tencent/pull/367)
- [Feature: support actuator for sct core components](https://github.com/Tencent/spring-cloud-tencent/pull/369)
- [docs: Fix javadoc <br \/> error](https://github.com/Tencent/spring-cloud-tencent/pull/376)
- [docs:optimize example](https://github.com/Tencent/spring-cloud-tencent/pull/387)
- [Feature: support spring cloud gateway routers](https://github.com/Tencent/spring-cloud-tencent/pull/390)
- [Optimize starter's auto-configuration](https://github.com/Tencent/spring-cloud-tencent/pull/396)
- [test: add PostInitPolarisSDKContextTest](https://github.com/Tencent/spring-cloud-tencent/pull/403)
- [refactor:optimize project and code](https://github.com/Tencent/spring-cloud-tencent/pull/407)

@ -1,40 +0,0 @@
# Change Log
---
- [Bugfix: optimize ratelimit actuator](https://github.com/Tencent/spring-cloud-tencent/pull/420)
- [Optimize: add EncodeTransferMedataRestTemplateInterceptor to RestTemplate](https://github.com/Tencent/spring-cloud-tencent/pull/440)
- [Feature: add rate limit filter debug log](https://github.com/Tencent/spring-cloud-tencent/pull/437)
- [Add configurable heartbeat interval support](https://github.com/Tencent/spring-cloud-tencent/pull/444)
- [feat:enhance Feign and RestTemplate and support Polaris monitor.](https://github.com/Tencent/spring-cloud-tencent/pull/447)
- [Feature: support spring cloud config data.](https://github.com/Tencent/spring-cloud-tencent/pull/451)
- [Optimize feign & rest-template circuit-breaker logic](https://github.com/Tencent/spring-cloud-tencent/pull/454)
- [Feature: Add disposable metadata transfer support](https://github.com/Tencent/spring-cloud-tencent/pull/459)
- [docs:update mvnw.](https://github.com/Tencent/spring-cloud-tencent/pull/476)
- [docs:update configuration metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/474)
- [Feature: delete implement ServiceInstance](https://github.com/Tencent/spring-cloud-tencent/pull/483)
- [test: add loadbalancer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/485)
- [Bugfix: update byte-buddy scope test to compile](https://github.com/Tencent/spring-cloud-tencent/pull/498)
- [Fix the code analysis error.](https://github.com/Tencent/spring-cloud-tencent/pull/500)
- [Fix typo & Code optimization](https://github.com/Tencent/spring-cloud-tencent/pull/512)
- [BeanFactoryUtils returns all beans including beans defined in ancestor bean factories](https://github.com/Tencent/spring-cloud-tencent/pull/517)
- [fix:add spring-cloud-starter-bootstrap dependency for example](https://github.com/Tencent/spring-cloud-tencent/pull/521)
- [Feature: Add router actuate endpoint](https://github.com/Tencent/spring-cloud-tencent/pull/523)
- [Optimize router label resolver spi](https://github.com/Tencent/spring-cloud-tencent/pull/524)
- [Code optimization for rpc-enhancement module](https://github.com/Tencent/spring-cloud-tencent/pull/526)
- [Feature: Optimized configuration update](https://github.com/Tencent/spring-cloud-tencent/pull/528)
- [Feature: support pushGateway push metrics](https://github.com/Tencent/spring-cloud-tencent/pull/529)
- [Feature: remove location metadata](https://github.com/Tencent/spring-cloud-tencent/pull/536)
- [Feature: remove location metadata](https://github.com/Tencent/spring-cloud-tencent/pull/542)
- [add feature-env plugin & add spring cloud gateway staining plugin](https://github.com/Tencent/spring-cloud-tencent/pull/533)
- [feature:add @ConditionalOnConfigReflectEnabled annotation](https://github.com/Tencent/spring-cloud-tencent/pull/539)
- [fix:set error handler named EnhancedRestTemplateReporter for RestTemplate](https://github.com/Tencent/spring-cloud-tencent/pull/545)
- [Optimize: add switch for report call result and default false](https://github.com/Tencent/spring-cloud-tencent/pull/550)
- [Optimize: shutdown server when connect to config server failed](https://github.com/Tencent/spring-cloud-tencent/pull/554)
- [Report the labels in request when report the result of invocation by Feign](https://github.com/Tencent/spring-cloud-tencent/pull/556)
- [fix:fix heartbeat interval different configuration from polaris-java SDK.](https://github.com/Tencent/spring-cloud-tencent/pull/559)
- [Optimize: optimize report call result for restTemplate.](https://github.com/Tencent/spring-cloud-tencent/pull/565)
- [feat:add spring-cloud-starter-tencent-all and quickstart examples.](https://github.com/Tencent/spring-cloud-tencent/pull/569)
- [refactor:optimize project and code.](https://github.com/Tencent/spring-cloud-tencent/pull/571)
- [Optimize:change default dynamic config refresh type to reflect.](https://github.com/Tencent/spring-cloud-tencent/pull/575)
- [feat:optimize examples.](https://github.com/Tencent/spring-cloud-tencent/pull/578)
- [fix:fix NullPointerException error when using RestTemplate with no label.](https://github.com/Tencent/spring-cloud-tencent/pull/586)

@ -1,24 +0,0 @@
# Change Log
---
- [Fix issue 593:When the project depends on spring-retry, executing restTemplate to call microservice and reporting NPE error](https://github.com/Tencent/spring-cloud-tencent/pull/594)
- [Optimize: remove discovery module useless code](https://github.com/Tencent/spring-cloud-tencent/pull/595)
- [Optimize: remove useless code for rest template router](https://github.com/Tencent/spring-cloud-tencent/pull/601)
- [Optimize: optimize configuration conditional & optimize config data tips](https://github.com/Tencent/spring-cloud-tencent/pull/603)
- [Automatically transmit some headers specified by an environment variable that directly defines header keys.](https://github.com/Tencent/spring-cloud-tencent/pull/606)
- [Optimize: Maybe remove Chinese characters](https://github.com/Tencent/spring-cloud-tencent/pull/607)
- [Optimize: InstanceId of PolarisRegistration and PolarisServiceRegistry](https://github.com/Tencent/spring-cloud-tencent/pull/610)
- [ fix pr #606 cause ci fail](https://github.com/Tencent/spring-cloud-tencent/pull/613)
- [fix pr 613: modify a judgment logic](https://github.com/Tencent/spring-cloud-tencent/pull/618)
- [fix pr 606: modify a part of changes requested by review.](https://github.com/Tencent/spring-cloud-tencent/pull/620)
- [Bugfix: fix feign report call result error when using feign direct call](https://github.com/Tencent/spring-cloud-tencent/pull/621)
- [remove useless code for router](https://github.com/Tencent/spring-cloud-tencent/pull/626)
- [Feature: support new label expression](https://github.com/Tencent/spring-cloud-tencent/pull/627)
- [feat:report the labels when using RestTemplate.](https://github.com/Tencent/spring-cloud-tencent/pull/629)
- [Bugfix: fix throw npe when router context is null](https://github.com/Tencent/spring-cloud-tencent/pull/635)
- [Optimize:optimize transfer](https://github.com/Tencent/spring-cloud-tencent/pull/636)
- [fix:cancel reporting useless metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/639)
- [Feature: support read config file from local file system](https://github.com/Tencent/spring-cloud-tencent/pull/640)
- [fix:optimize expression parser V1.](https://github.com/Tencent/spring-cloud-tencent/pull/642)
- [Optimize: add transfer metadata unit test.](https://github.com/Tencent/spring-cloud-tencent/pull/646)
- [feat: publish spring event named ConfigChangeSpringEvent when the configuration is changed](https://github.com/Tencent/spring-cloud-tencent/pull/647)

@ -1,4 +0,0 @@
# Change Log
---
- [fix:fix transfer http headers not working bug.](https://github.com/Tencent/spring-cloud-tencent/pull/664)

@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>3.1.5</version>
<version>4.0.1</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -16,7 +16,7 @@
<version>${revision}</version>
<name>Spring Cloud Tencent</name>
<description>Spring Cloud Tencent</description>
<url>https://github.com/Tencent/spring-cloud-tencent/tree/2021.0</url>
<url>https://github.com/Tencent/spring-cloud-tencent/tree/2022.0</url>
<organization>
<name>Tencent</name>
@ -26,7 +26,7 @@
<licenses>
<license>
<name>The BSD 3-Clause License (BSD3)</name>
<url>https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2021.0/LICENSE</url>
<url>https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2022.0/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
@ -89,22 +89,20 @@
<properties>
<!-- Project revision -->
<revision>1.9.0-2021.0.5-SNAPSHOT</revision>
<revision>1.9.0-2022.0.1</revision>
<!-- Spring Cloud -->
<spring.cloud.version>2021.0.5</spring.cloud.version>
<spring.cloud.version>2022.0.1</spring.cloud.version>
<!-- Spring Boot -->
<spring.boot.version>2.6.14</spring.boot.version>
<spring.boot.version>3.0.2</spring.boot.version>
<!-- Spring Framework -->
<spring.framework.version>5.3.25</spring.framework.version>
<spring.framework.version>6.0.4</spring.framework.version>
<!-- Maven Plugin Versions -->
<jacoco.version>0.8.8</jacoco.version>
<maven-source-plugin.version>3.2.0</maven-source-plugin.version>
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
<!-- Checkstyle -->
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
@ -124,15 +122,16 @@
<scope>import</scope>
</dependency>
<!-- Spring Cloud Dependencies -->
<!-- Spring Framework Dependencies -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring.cloud.version}</version>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring Boot Dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
@ -141,11 +140,11 @@
<scope>import</scope>
</dependency>
<!-- Spring Framework Dependencies -->
<!-- Spring Cloud Dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.framework.version}</version>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring.cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -172,9 +171,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
<target>1.8</target>
<parameters>true</parameters>
<release>17</release>
</configuration>
</plugin>
<plugin>
@ -211,6 +208,7 @@
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<argLine>${argLine}</argLine>
</configuration>
</plugin>
<plugin>
@ -271,7 +269,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
@ -285,7 +282,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>

@ -40,11 +40,11 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.web.client.RestTemplate;
import static javax.servlet.DispatcherType.ASYNC;
import static javax.servlet.DispatcherType.ERROR;
import static javax.servlet.DispatcherType.FORWARD;
import static javax.servlet.DispatcherType.INCLUDE;
import static javax.servlet.DispatcherType.REQUEST;
import static jakarta.servlet.DispatcherType.ASYNC;
import static jakarta.servlet.DispatcherType.ERROR;
import static jakarta.servlet.DispatcherType.FORWARD;
import static jakarta.servlet.DispatcherType.INCLUDE;
import static jakarta.servlet.DispatcherType.REQUEST;
/**
* Metadata transfer auto configuration.

@ -23,9 +23,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.tencent.cloud.common.constant.MetadataConstant;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.http.HttpHeaders;

@ -24,14 +24,13 @@ import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.tencent.cloud.common.constant.MetadataConstant;
import com.tencent.cloud.common.metadata.MetadataContextHolder;
import com.tencent.cloud.common.util.JacksonUtils;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ -24,10 +24,10 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import com.tencent.cloud.common.metadata.MetadataContextHolder;
import com.tencent.cloud.common.util.JacksonUtils;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.reactive.ServerHttpRequest;

@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.metadata.config.MetadataTransferAutoConfiguration

@ -19,11 +19,10 @@ package com.tencent.cloud.metadata.core;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import com.tencent.cloud.common.constant.MetadataConstant;
import com.tencent.cloud.common.metadata.config.MetadataLocalProperties;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;

@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;

@ -1,4 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.polaris.circuitbreaker.config.PolarisCircuitBreakerAutoConfiguration
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.tencent.cloud.polaris.circuitbreaker.config.PolarisCircuitBreakerBootstrapConfiguration

@ -39,6 +39,7 @@ import org.springframework.cloud.context.properties.ConfigurationPropertiesRebin
import org.springframework.cloud.context.refresh.ContextRefresher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
/**
* polaris config module auto configuration at init application context phase.
@ -60,7 +61,7 @@ public class PolarisConfigAutoConfiguration {
}
@Bean
@ConditionalOnMissingBean(search = SearchStrategy.CURRENT)
@Primary
@ConditionalOnReflectRefreshType
public ConfigurationPropertiesRebinder affectedConfigurationPropertiesRebinder(
ConfigurationPropertiesBeans beans) {

@ -1,9 +1,5 @@
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.tencent.cloud.polaris.config.PolarisConfigBootstrapAutoConfiguration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.polaris.config.PolarisConfigAutoConfiguration,\
com.tencent.cloud.polaris.config.endpoint.PolarisConfigEndpointAutoConfiguration,\
com.tencent.cloud.polaris.config.PolarisConfigBootstrapAutoConfiguration
# ConfigData Location Resolvers
org.springframework.boot.context.config.ConfigDataLocationResolver=\

@ -0,0 +1,3 @@
com.tencent.cloud.polaris.config.PolarisConfigAutoConfiguration
com.tencent.cloud.polaris.config.endpoint.PolarisConfigEndpointAutoConfiguration
com.tencent.cloud.polaris.config.PolarisConfigBootstrapAutoConfiguration

@ -81,6 +81,7 @@ public class SpringValueProcessorTest {
.withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class))
.withConfiguration(AutoConfigurations.of(ValueTest.class))
.withConfiguration(AutoConfigurations.of(PolarisConfigAutoConfiguration.class))
.withAllowBeanDefinitionOverriding(true)
.withPropertyValues("spring.application.name=" + "conditionalOnConfigReflectEnabledTest")
.withPropertyValues("spring.cloud.polaris.address=grpc://127.0.0.1:10081")
.withPropertyValues("spring.cloud.polaris.config.refresh-type=" + RefreshType.REFLECT)
@ -118,6 +119,7 @@ public class SpringValueProcessorTest {
.withPropertyValues("spring.cloud.polaris.address=grpc://127.0.0.1:10081")
.withPropertyValues("spring.cloud.polaris.config.refresh-type=" + RefreshType.REFLECT)
.withPropertyValues("spring.cloud.polaris.config.enabled=true")
.withAllowBeanDefinitionOverriding(true)
.withPropertyValues("name=test");
contextRunner.run(context -> {
SpringValueRegistry springValueRegistry = context.getBean(SpringValueRegistry.class);
@ -151,6 +153,7 @@ public class SpringValueProcessorTest {
.withPropertyValues("spring.cloud.polaris.address=grpc://127.0.0.1:10081")
.withPropertyValues("spring.cloud.polaris.config.refresh-type=" + RefreshType.REFLECT)
.withPropertyValues("spring.cloud.polaris.config.enabled=true")
.withAllowBeanDefinitionOverriding(true)
.withPropertyValues("name=test");
contextRunner.run(context -> {
Person person = context.getBean(Person.class);

@ -17,12 +17,13 @@
package com.tencent.cloud.polaris.util;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -38,52 +39,46 @@ public final class OkHttpUtil {
*/
public final static Logger LOGGER = LoggerFactory.getLogger(OkHttpUtil.class);
/**
* client.
*/
private final static OkHttpClient HTTP_CLIENT = new OkHttpClient();
private OkHttpUtil() {
}
/**
* get request.
* @param url url
* @param path path
* @param headers headers
* @return response
*/
public static boolean get(String url, Map<String, String> headers) {
public static boolean get(String path, Map<String, String> headers) {
HttpURLConnection conn = null;
try {
Request.Builder builder = new Request.Builder();
buildHeader(builder, headers);
Request request = builder.url(url).build();
Response response = HTTP_CLIENT.newCall(request).execute();
URL url = new java.net.URL(path);
conn = (HttpURLConnection) url.openConnection();
if (response.isSuccessful() && Objects.nonNull(response.body())) {
String result = response.body().string();
LOGGER.debug("exec get request, url: {} success, response data: {}", url, result);
conn.setRequestMethod("GET");
conn.setConnectTimeout((int) TimeUnit.SECONDS.toMillis(2));
conn.setReadTimeout((int) TimeUnit.SECONDS.toMillis(2));
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer buffer = new StringBuffer();
String str;
while ((str = reader.readLine()) != null) {
buffer.append(str);
}
String responseBody = buffer.toString();
if (conn.getResponseCode() == 200 && !responseBody.isBlank()) {
LOGGER.debug("exec get request, url: {} success, response data: {}", url, responseBody);
return true;
}
}
catch (Exception e) {
LOGGER.error("exec get request, url: {} failed!", url, e);
LOGGER.error("exec get request, url: {} failed!", path, e);
return false;
}
return false;
}
/**
* build header.
* @param builder builder
* @param headers headers
*/
private static void buildHeader(Request.Builder builder, Map<String, String> headers) {
if (Objects.nonNull(headers) && headers.size() > 0) {
headers.forEach((k, v) -> {
if (Objects.nonNull(k) && Objects.nonNull(v)) {
builder.addHeader(k, v);
}
});
finally {
if (null != conn) {
conn.disconnect();
}
}
return false;
}
}

@ -1,7 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.polaris.DiscoveryPropertiesAutoConfiguration,\
com.tencent.cloud.polaris.discovery.PolarisDiscoveryAutoConfiguration,\
com.tencent.cloud.polaris.registry.PolarisServiceRegistryAutoConfiguration,\
com.tencent.cloud.polaris.endpoint.PolarisDiscoveryEndpointAutoConfiguration
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.tencent.cloud.polaris.DiscoveryPropertiesBootstrapAutoConfiguration

@ -0,0 +1,4 @@
com.tencent.cloud.polaris.DiscoveryPropertiesAutoConfiguration
com.tencent.cloud.polaris.discovery.PolarisDiscoveryAutoConfiguration
com.tencent.cloud.polaris.registry.PolarisServiceRegistryAutoConfiguration
com.tencent.cloud.polaris.endpoint.PolarisDiscoveryEndpointAutoConfiguration

@ -23,7 +23,7 @@ import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@ -39,11 +39,11 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.lang.Nullable;
import static com.tencent.cloud.polaris.ratelimit.filter.QuotaCheckServletFilter.QUOTA_FILTER_BEAN_NAME;
import static javax.servlet.DispatcherType.ASYNC;
import static javax.servlet.DispatcherType.ERROR;
import static javax.servlet.DispatcherType.FORWARD;
import static javax.servlet.DispatcherType.INCLUDE;
import static javax.servlet.DispatcherType.REQUEST;
import static jakarta.servlet.DispatcherType.ASYNC;
import static jakarta.servlet.DispatcherType.ERROR;
import static jakarta.servlet.DispatcherType.FORWARD;
import static jakarta.servlet.DispatcherType.INCLUDE;
import static jakarta.servlet.DispatcherType.REQUEST;
/**
* Configuration of rate limit.

@ -24,8 +24,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.annotation.PostConstruct;
import com.google.common.collect.Maps;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.util.expresstion.SpringWebExpressionLabelUtils;
@ -38,6 +36,7 @@ import com.tencent.cloud.polaris.ratelimit.utils.RateLimitUtils;
import com.tencent.polaris.ratelimit.api.core.LimitAPI;
import com.tencent.polaris.ratelimit.api.rpc.QuotaResponse;
import com.tencent.polaris.ratelimit.api.rpc.QuotaResultCode;
import jakarta.annotation.PostConstruct;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ -24,12 +24,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.annotation.PostConstruct;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.util.expresstion.ServletExpressionLabelUtils;
import com.tencent.cloud.polaris.ratelimit.RateLimitRuleLabelResolver;
@ -41,6 +35,11 @@ import com.tencent.cloud.polaris.ratelimit.utils.RateLimitUtils;
import com.tencent.polaris.ratelimit.api.core.LimitAPI;
import com.tencent.polaris.ratelimit.api.rpc.QuotaResponse;
import com.tencent.polaris.ratelimit.api.rpc.QuotaResultCode;
import jakarta.annotation.PostConstruct;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ -20,7 +20,7 @@ package com.tencent.cloud.polaris.ratelimit.spi;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
/**
* Resolve custom label from request. The label used for rate limit params.

@ -1,6 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.polaris.ratelimit.config.PolarisRateLimitAutoConfiguration,\
com.tencent.cloud.polaris.ratelimit.config.PolarisRateLimitPropertiesAutoConfiguration,\
com.tencent.cloud.polaris.ratelimit.endpoint.PolarisRateLimitRuleEndpointAutoConfiguration
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.tencent.cloud.polaris.ratelimit.config.PolarisRateLimitPropertiesBootstrapConfiguration

@ -0,0 +1,3 @@
com.tencent.cloud.polaris.ratelimit.config.PolarisRateLimitAutoConfiguration
com.tencent.cloud.polaris.ratelimit.config.PolarisRateLimitPropertiesAutoConfiguration
com.tencent.cloud.polaris.ratelimit.endpoint.PolarisRateLimitRuleEndpointAutoConfiguration

@ -34,7 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;

@ -24,10 +24,6 @@ import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Map;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import com.tencent.cloud.common.metadata.MetadataContext;
import com.tencent.cloud.common.util.ApplicationContextAwareUtils;
import com.tencent.cloud.common.util.expresstion.SpringWebExpressionLabelUtils;
@ -38,6 +34,9 @@ import com.tencent.polaris.api.plugin.ratelimiter.QuotaResult;
import com.tencent.polaris.ratelimit.api.core.LimitAPI;
import com.tencent.polaris.ratelimit.api.rpc.QuotaRequest;
import com.tencent.polaris.ratelimit.api.rpc.QuotaResponse;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;

@ -144,23 +144,25 @@ public class PolarisRouterServiceInstanceListSupplier extends DelegatingServiceI
Flux<List<ServiceInstance>> doRouter(Flux<List<ServiceInstance>> allServers, PolarisRouterContext routerContext) {
ServiceInstances serviceInstances = LoadBalancerUtils.transferServersToServiceInstances(allServers);
// filter instance by routers
ProcessRoutersRequest processRoutersRequest = buildProcessRoutersRequest(serviceInstances, routerContext);
List<ServiceInstance> filteredInstances = new ArrayList<>();
if (serviceInstances.getInstances().size() > 0) {
// filter instance by routers
ProcessRoutersRequest processRoutersRequest = buildProcessRoutersRequest(serviceInstances, routerContext);
// process request interceptors
processRouterRequestInterceptors(processRoutersRequest, routerContext);
// process request interceptors
processRouterRequestInterceptors(processRoutersRequest, routerContext);
// process router chain
ProcessRoutersResponse processRoutersResponse = routerAPI.processRouters(processRoutersRequest);
// process router chain
ProcessRoutersResponse processRoutersResponse = routerAPI.processRouters(processRoutersRequest);
// process response interceptors
processRouterResponseInterceptors(routerContext, processRoutersResponse);
// process response interceptors
processRouterResponseInterceptors(routerContext, processRoutersResponse);
// transfer polaris server to ServiceInstance
List<ServiceInstance> filteredInstances = new ArrayList<>();
ServiceInstances filteredServiceInstances = processRoutersResponse.getServiceInstances();
for (Instance instance : filteredServiceInstances.getInstances()) {
filteredInstances.add(new PolarisServiceInstance(instance));
// transfer polaris server to ServiceInstance
ServiceInstances filteredServiceInstances = processRoutersResponse.getServiceInstances();
for (Instance instance : filteredServiceInstances.getInstances()) {
filteredInstances.add(new PolarisServiceInstance(instance));
}
}
return Flux.fromIterable(Collections.singletonList(filteredInstances));
}

@ -36,6 +36,7 @@ import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.Selector;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* Router actuator endpoint.
@ -54,20 +55,21 @@ public class PolarisRouterEndpoint {
@ReadOperation
public Map<String, Object> router(@Selector String dstService) {
List<RoutingProto.Route> routerRules = serviceRuleManager.getServiceRouterRule(MetadataContext.LOCAL_NAMESPACE,
MetadataContext.LOCAL_SERVICE, dstService);
Map<String, Object> result = new HashMap<>();
List<Object> rules = new LinkedList<>();
result.put("routerRules", rules);
if (StringUtils.hasText(dstService)) {
List<RoutingProto.Route> routerRules = serviceRuleManager.getServiceRouterRule(MetadataContext.LOCAL_NAMESPACE,
MetadataContext.LOCAL_SERVICE, dstService);
List<Object> rules = new LinkedList<>();
result.put("routerRules", rules);
if (CollectionUtils.isEmpty(routerRules)) {
return result;
}
if (CollectionUtils.isEmpty(routerRules)) {
return result;
}
for (RoutingProto.Route route : routerRules) {
rules.add(parseRouterRule(route));
for (RoutingProto.Route route : routerRules) {
rules.add(parseRouterRule(route));
}
}
return result;

@ -1,4 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.polaris.router.config.RouterAutoConfiguration,\
com.tencent.cloud.polaris.router.config.FeignAutoConfiguration,\
com.tencent.cloud.polaris.router.endpoint.PolarisRouterEndpointAutoConfiguration

@ -0,0 +1,3 @@
com.tencent.cloud.polaris.router.config.RouterAutoConfiguration
com.tencent.cloud.polaris.router.config.FeignAutoConfiguration
com.tencent.cloud.polaris.router.endpoint.PolarisRouterEndpointAutoConfiguration

@ -101,7 +101,7 @@ public class PolarisRouterEndpointTest {
Map<String, Object> actuator = polarisRouterEndpoint.router(testDestService);
Assert.assertNotNull(actuator.get("routerRules"));
Assert.assertEquals(1, ((List) actuator.get("routerRules")).size());
Assert.assertEquals(1, ((List<?>) actuator.get("routerRules")).size());
}
@Test

@ -186,8 +186,8 @@ public class RouterLabelRestTemplateInterceptorTest {
}
@Override
public String getMethodValue() {
return HttpMethod.GET.name();
public HttpMethod getMethod() {
return HttpMethod.GET;
}
@Override

@ -23,9 +23,9 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;

@ -1,4 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.common.util.ApplicationContextAwareUtils,\
com.tencent.cloud.common.metadata.config.MetadataAutoConfiguration,\
com.tencent.cloud.common.metadata.endpoint.PolarisMetadataEndpointAutoConfiguration

@ -0,0 +1,3 @@
com.tencent.cloud.common.util.ApplicationContextAwareUtils
com.tencent.cloud.common.metadata.config.MetadataAutoConfiguration
com.tencent.cloud.common.metadata.endpoint.PolarisMetadataEndpointAutoConfiguration

@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies-parent</artifactId>
<version>3.1.5</version>
<version>4.0.1</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -16,7 +16,7 @@
<packaging>pom</packaging>
<name>Spring Cloud Tencent Dependencies</name>
<description>Spring Cloud Tencent Dependencies</description>
<url>https://github.com/Tencent/spring-cloud-tencent/tree/2021.0</url>
<url>https://github.com/Tencent/spring-cloud-tencent/tree/2022.0</url>
<organization>
<name>Tencent</name>
@ -26,7 +26,7 @@
<licenses>
<license>
<name>The BSD 3-Clause License (BSD3)</name>
<url>https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2021.0/LICENSE</url>
<url>https://raw.githubusercontent.com/Tencent/spring-cloud-tencent/2022.0/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
@ -70,23 +70,19 @@
</developers>
<properties>
<revision>1.9.0-2021.0.5-SNAPSHOT</revision>
<revision>1.9.0-2022.0.1</revision>
<!-- Dependencies -->
<polaris.version>1.10.2</polaris.version>
<guava.version>31.0.1-jre</guava.version>
<logback.version>1.2.11</logback.version>
<mocktio.version>4.5.1</mocktio.version>
<byte-buddy.version>1.12.10</byte-buddy.version>
<polaris.version>1.10.5</polaris.version>
<guava.version>31.1-jre</guava.version>
<mocktio.version>4.9.0</mocktio.version>
<byte-buddy.version>1.12.19</byte-buddy.version>
<protobuf-java.version>3.21.7</protobuf-java.version>
<bcprov-jdk15on.version>1.69</bcprov-jdk15on.version>
<system-stubs-junit4.version>2.0.1</system-stubs-junit4.version>
<!-- Maven Plugin Versions -->
<maven-javadoc-plugin.verison>3.3.0</maven-javadoc-plugin.verison>
<maven-source-plugin.version>3.2.0</maven-source-plugin.version>
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
</properties>
<dependencyManagement>
@ -207,18 +203,6 @@
</exclusions>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
@ -298,7 +282,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.verison}</version>
<executions>
<execution>
<id>attach-javadocs</id>
@ -312,7 +295,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
@ -326,7 +308,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<phase>verify</phase>

@ -4,6 +4,16 @@ spring:
application:
name: polaris-circuitbreaker-example-a
cloud:
openfeign:
circuitbreaker:
enabled: true
compression:
request:
enabled: false
mime-types: text/xml,application/xml,application/json
min-request-size: 2048
response:
enabled: false
polaris:
address: grpc://183.47.111.80:8091
namespace: default
@ -22,17 +32,3 @@ spring:
ignore-internal-server-error: true
series: server_error
statuses: gateway_timeout, bad_gateway, service_unavailable
feign:
circuitbreaker:
enabled: true
compression:
request:
enabled: false
mime-types: text/xml,application/xml,application/json
min-request-size: 2048
response:
enabled: false
serivceB:
url: http://localhost:48081

@ -13,10 +13,6 @@
<artifactId>discovery-caller-service</artifactId>
<name>Polaris Discovery Caller Service</name>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>

@ -21,9 +21,8 @@ package com.tencent.cloud.ratelimit.example.service.callee;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.tencent.cloud.polaris.ratelimit.spi.PolarisRateLimiterLabelServletResolver;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

@ -42,5 +42,4 @@
</dependency>
</dependencies>
</dependencyManagement>
</project>

@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.plugin.featureenv.FeatureEnvAutoConfiguration

@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.plugin.gateway.SCGPluginsAutoConfiguration

@ -1,4 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.plugin.pushgateway.PolarisStatPushGatewayAutoConfiguration
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.tencent.cloud.plugin.pushgateway.PolarisStatPushGatewayBootstrapConfiguration

@ -34,6 +34,8 @@ import com.tencent.polaris.client.flow.FlowControlParam;
import com.tencent.polaris.client.flow.ResourcesResponse;
import com.tencent.polaris.client.pb.RateLimitProto;
import com.tencent.polaris.client.pb.RoutingProto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* the manager of service governance rules. for example: rate limit rule, router rules.
@ -42,8 +44,8 @@ import com.tencent.polaris.client.pb.RoutingProto;
*/
public class ServiceRuleManager {
private static final Logger LOG = LoggerFactory.getLogger(ServiceRuleManager.class);
private final SDKContext sdkContext;
private final FlowControlParam controlParam;
public ServiceRuleManager(SDKContext sdkContext) {
@ -55,6 +57,7 @@ public class ServiceRuleManager {
}
public RateLimitProto.RateLimit getServiceRateLimitRule(String namespace, String service) {
LOG.debug("Get service rate limit rules with namespace:{} and service:{}.", namespace, service);
ServiceEventKey serviceEventKey = new ServiceEventKey(new ServiceKey(namespace, service),
ServiceEventKey.EventType.RATE_LIMITING);
@ -76,6 +79,8 @@ public class ServiceRuleManager {
}
public List<RoutingProto.Route> getServiceRouterRule(String namespace, String sourceService, String dstService) {
LOG.debug("Get service router rules with namespace:{} and sourceService:{} and dstService:{}.",
namespace, sourceService, dstService);
Set<ServiceEventKey> routerKeys = new HashSet<>();
ServiceEventKey dstSvcEventKey = new ServiceEventKey(new ServiceKey(namespace, dstService),

@ -1,6 +1,3 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.polaris.context.config.PolarisContextAutoConfiguration,\
com.tencent.cloud.polaris.context.config.PolarisContextPostConfiguration
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.tencent.cloud.polaris.context.config.PolarisContextBootstrapAutoConfiguration
org.springframework.context.ApplicationListener=\

@ -0,0 +1,2 @@
com.tencent.cloud.polaris.context.config.PolarisContextAutoConfiguration
com.tencent.cloud.polaris.context.config.PolarisContextPostConfiguration

@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.polaris.loadbalancer.config.PolarisLoadBalancerAutoConfiguration

@ -42,6 +42,8 @@ import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.lang.NonNull;
import org.springframework.web.client.ResponseErrorHandler;
@ -129,7 +131,9 @@ public class EnhancedRestTemplateReporter extends AbstractPolarisReporterAdapter
resultRequest.setPort(Integer.parseInt(targetPort));
// checking response http status code
if (apply(response.getStatusCode())) {
HttpStatusCode httpStatusCode = response.getStatusCode();
HttpStatus httpStatus = HttpStatus.valueOf(httpStatusCode.value());
if (apply(httpStatus)) {
resultRequest.setRetStatus(RetStatus.RetFail);
}

@ -1,6 +1,3 @@
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
com.tencent.cloud.rpc.enhancement.stat.config.PolarisStatPropertiesBootstrapConfiguration,\
com.tencent.cloud.rpc.enhancement.config.RpcEnhancementBootstrapConfiguration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.tencent.cloud.rpc.enhancement.config.RpcEnhancementAutoConfiguration,\
com.tencent.cloud.rpc.enhancement.stat.config.PolarisStatPropertiesAutoConfiguration

@ -0,0 +1,2 @@
com.tencent.cloud.rpc.enhancement.config.RpcEnhancementAutoConfiguration
com.tencent.cloud.rpc.enhancement.stat.config.PolarisStatPropertiesAutoConfiguration
Loading…
Cancel
Save