This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch spring6
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git

commit ae8963dd095259107a1ce2f2932fdc0be62e8562
Author: kezhenxu94 <kezhenx...@apache.org>
AuthorDate: Fri Feb 24 14:17:43 2023 +0800

    Try to fix Spring 6 test case
---
 .github/workflows/plugins-jdk17-test.1.yaml        |  3 ++
 .github/workflows/plugins-test.2.yaml              | 23 ++--------
 .github/workflows/plugins-test.3.yaml              | 53 ++--------------------
 apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml  |  1 +
 .../spring-plugins/resttemplate-4.x-plugin/pom.xml |  5 ++
 .../ResponseExtractorFutureInstrumentation4x.java  | 43 ++++++++++++++++++
 .../define/RestTemplateInstrumentation4x.java      | 41 +++++++++++++++++
 .../sync/define/RestTemplateInstrumentation4x.java | 38 ++++++++++++++++
 .../src/main/resources/skywalking-plugin.def       |  6 +--
 .../pom.xml                                        |  6 +--
 .../resttemplate/async/FutureGetInterceptor.java   |  0
 .../async/ResponseCallBackInterceptor.java         |  0
 .../resttemplate/async/RestExecuteInterceptor.java |  0
 .../resttemplate/async/RestRequestInterceptor.java |  0
 .../ResponseExtractorFutureInstrumentation.java    |  9 +---
 .../async/define/RestTemplateInstrumentation.java  |  9 +---
 .../helper/RestTemplateRuntimeContextHelper.java   |  0
 .../resttemplate/sync/RestExecuteInterceptor.java  |  0
 .../resttemplate/sync/RestRequestInterceptor.java  |  0
 .../resttemplate/sync/RestResponseInterceptor.java |  0
 .../sync/define/RestTemplateInstrumentation.java   |  9 +---
 .../sync/define/RestTemplateInstrumentation.java   |  7 ++-
 22 files changed, 150 insertions(+), 103 deletions(-)

diff --git a/.github/workflows/plugins-jdk17-test.1.yaml 
b/.github/workflows/plugins-jdk17-test.1.yaml
index d820466d8c..6a671c312b 100644
--- a/.github/workflows/plugins-jdk17-test.1.yaml
+++ b/.github/workflows/plugins-jdk17-test.1.yaml
@@ -17,6 +17,9 @@
 name: Test
 
 on:
+  push:
+    branches:
+      - spring6
   pull_request:
     paths:
       - '.github/workflows/plugins-*.yaml'
diff --git a/.github/workflows/plugins-test.2.yaml 
b/.github/workflows/plugins-test.2.yaml
index 1b6ecaa9f9..c58dd82782 100644
--- a/.github/workflows/plugins-test.2.yaml
+++ b/.github/workflows/plugins-test.2.yaml
@@ -17,6 +17,9 @@
 name: Test
 
 on:
+  push:
+    branches:
+      - spring6
   pull_request:
     paths:
       - '.github/workflows/plugins-*.yaml'
@@ -52,31 +55,11 @@ jobs:
     strategy:
       matrix:
         case:
-          - okhttp-scenario
-          - play-scenario
-          - postgresql-scenario
-          - pulsar-scenario
-          - rabbitmq-scenario
-          - redisson-scenario
-          - resttemplate-4.x-scenario
-          - servicecomb-1.x-scenario
-          - servicecomb-2.x-scenario
-          - shardingsphere-3.x-scenario
-          - shardingsphere-4.0.x-scenario
-          - shardingsphere-4.x-scenario
-          - shardingsphere-5.0.0-scenario
-          - sofarpc-scenario
-          - solrj-7.x-scenario
           - spring-3.0.x-scenario
           - spring-cloud-feign-1.1.x-scenario
           - spring-cloud-feign-1.2.x-scenario
           - spring-cloud-feign-2.x-scenario
           - spring-tx-scenario
-          - struts2.3-scenario
-          - struts2.5-scenario
-          - cxf-scenario
-          - okhttp2-scenario
-          - rocketmq-scenario
     steps:
       - uses: actions/checkout@v2
         with:
diff --git a/.github/workflows/plugins-test.3.yaml 
b/.github/workflows/plugins-test.3.yaml
index 3127472d31..3d917bdd89 100644
--- a/.github/workflows/plugins-test.3.yaml
+++ b/.github/workflows/plugins-test.3.yaml
@@ -17,6 +17,9 @@
 name: Test
 
 on:
+  push:
+    branches:
+      - spring6
   pull_request:
     paths:
       - '.github/workflows/plugins-*.yaml'
@@ -52,60 +55,10 @@ jobs:
     strategy:
       matrix:
         case:
-          - mysql-scenario
-          - undertow-scenario
-          - webflux-scenario
-          - zookeeper-scenario
           - spring-3.1.x-scenario
           - spring-4.1.x-scenario
           - spring-4.3.x-scenario
           - spring-async-scenario
-          - vertx-core-4.x-scenario
-          - vertx-eventbus-3.x-scenario
-          - vertx-web-3.54minus-scenario
-          - vertx-web-3.6plus-scenario
-          - mariadb-scenario
-          - micronaut-http-scenario
-          - nats-2.14.x-2.15.x-scenario
-          - quasar-scenario
-          - baidu-brpc-scenario
-          - baidu-brpc-3.x-scenario
-          - retransform-class-scenario
-          - retransform-class-tomcat-scenario
-          - graphql-8.x-scenario
-          - graphql-9.x-scenario
-          - graphql-16plus-scenario
-          - graphql-12.x-15.x-scenario
-          - hbase-scenario
-          - spring-kafka-1.3.x-scenario
-          - spring-kafka-2.2.x-scenario
-          - spring-kafka-2.3.x-scenario
-          - spring-scheduled-scenario
-          - elasticjob-2.x-scenario
-          - quartz-scheduler-2.x-scenario
-          - xxl-job-2.2.0-scenario
-          - xxl-job-2.3.x-scenario
-          - thrift-scenario
-          - dbcp-2.x-scenario
-          - jsonrpc4j-1.x-scenario
-          - gateway-3.x-scenario
-          - neo4j-4.x-scenario
-          - oracle-scenario
-          - druid-1.x-scenario
-          - hikaricp-scenario
-          - clickhouse-0.3.1-scenario
-          - clickhouse-0.3.2.x-scenario
-          - kylin-jdbc-2.6.x-3.x-4.x-scenario
-          - undertow-worker-thread-pool-scenario
-          - tomcat-thread-pool-scenario
-          - guava-eventbus-scenario
-          - shenyu-2.4.x-scenario
-          - jdk-threadpool-scenario
-          - shenyu-2.4.x-dubbo-scenario
-          - grpc-generic-call-scenario
-          - shenyu-2.4.x-grpc-scenario
-          - shenyu-2.4.x-sofarpc-scenario
-          - impala-jdbc-2.6.x-scenario
     steps:
       - uses: actions/checkout@v2
         with:
diff --git a/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
index da106f5e68..2d50091fe4 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/pom.xml
@@ -42,6 +42,7 @@
         <module>spring-kafka-2.x-plugin</module>
         <module>scheduled-annotation-plugin</module>
         <module>spring-webflux-5.x-webclient-plugin</module>
+        <module>resttemplate-commons</module>
     </modules>
     <packaging>pom</packaging>
 
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
index bcc756a8af..071a420215 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
@@ -47,5 +47,10 @@
             <artifactId>spring-commons</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.skywalking</groupId>
+            <artifactId>resttemplate-commons</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation4x.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation4x.java
new file mode 100644
index 0000000000..b3a3d031f0
--- /dev/null
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation4x.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.spring.resttemplate.async.define;
+
+import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
+import 
org.apache.skywalking.apm.plugin.spring.resttemplate.async.ResponseCallBackInterceptor;
+
+import java.net.URI;
+
+/**
+ * {@link ResponseExtractorFutureInstrumentation4x} enhance the 
<code>addCallback</code> method and
+ * <code>getDefault</code> method of 
<code>org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture</code>
+ * by
+ * <code>ResponseCallBackInterceptor</code> and
+ * <code>FutureGetInterceptor</code>.
+ * <p>
+ * {@link ResponseCallBackInterceptor} set the {@link URI} and {@link 
ContextSnapshot} to inherited
+ * <code>org.springframework.util.concurrent.SuccessCallback</code> and 
<code>org.springframework.util.concurrent.FailureCallback</code>
+ */
+public class ResponseExtractorFutureInstrumentation4x extends 
ResponseExtractorFutureInstrumentation {
+    @Override
+    protected String[] witnessClasses() {
+        return new String[] {
+            
"org.springframework.web.context.support.ServletContextAttributeFactoryBean"
+        };
+    }
+}
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation4x.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation4x.java
new file mode 100644
index 0000000000..87da28d960
--- /dev/null
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation4x.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.spring.resttemplate.async.define;
+
+import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
+
+import java.net.URI;
+
+/**
+ * {@link RestTemplateInstrumentation4x} enhance the <code>doExecute</code> 
method and <code>createAsyncRequest</code>
+ * method of <code>org.springframework.web.client.AsyncRestTemplate</code> by 
<code>RestExecuteInterceptor</code> and
+ * <code>org.springframework.http.client.RestRequestInterceptor</code>.
+ *
+ * <code>org.springframework.http.client.RestRequestInterceptor</code> set 
{@link URI} and {@link ContextSnapshot} to
+ * 
<code>org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture</code>
 for propagate trace context
+ * after execute <code>doExecute</code> .
+ */
+public class RestTemplateInstrumentation4x extends RestTemplateInstrumentation 
{
+    @Override
+    protected String[] witnessClasses() {
+        return new String[] {
+            
"org.springframework.web.context.support.ServletContextAttributeFactoryBean"
+        };
+    }
+}
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation4x.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation4x.java
new file mode 100644
index 0000000000..319ff6244c
--- /dev/null
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation4x.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define;
+
+/**
+ * {@link RestTemplateInstrumentation} enhance the <code>doExecute</code> 
method,<code>handleResponse</code> method and
+ * <code>handleResponse</code> method of 
<code>org.springframework.web.client.RestTemplate</code> by
+ * <code>RestExecuteInterceptor</code>,
+ * <code>RestResponseInterceptor</code> and
+ * <code>RestRequestInterceptor</code>.
+ *
+ * <code>RestResponseInterceptor</code> set context to  header for
+ * propagate trace context after execute <code>createRequest</code>.
+ */
+public class RestTemplateInstrumentation4x extends RestTemplateInstrumentation 
{
+    @Override
+    protected String[] witnessClasses() {
+        return new String[] {
+            
"org.springframework.web.context.support.ServletContextAttributeFactoryBean"
+        };
+    }
+}
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
index 98a8a1b7cb..909ddfb3f8 100644
--- 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/resources/skywalking-plugin.def
@@ -14,6 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define.RestTemplateInstrumentation
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.ResponseExtractorFutureInstrumentation
-spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.RestTemplateInstrumentation
+spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.sync.define.RestTemplateInstrumentation4x
+spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.ResponseExtractorFutureInstrumentation4x
+spring-resttemplate-4.x=org.apache.skywalking.apm.plugin.spring.resttemplate.async.define.RestTemplateInstrumentation4x
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/pom.xml
similarity index 91%
copy from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
copy to apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/pom.xml
index bcc756a8af..0a2feba4c3 100644
--- a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/pom.xml
@@ -24,11 +24,9 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>apm-resttemplate-4.3.x-plugin</artifactId>
-    <packaging>jar</packaging>
+    <artifactId>resttemplate-commons</artifactId>
 
-    <name>resttemplate-4.3.x-plugin</name>
-    <url>http://maven.apache.org</url>
+    <name>resttemplate-commons</name>
 
     <properties>
         <spring-web.version>4.3.10.RELEASE</spring-web.version>
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
similarity index 100%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/FutureGetInterceptor.java
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java
similarity index 100%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/ResponseCallBackInterceptor.java
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java
similarity index 100%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestExecuteInterceptor.java
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java
similarity index 100%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/RestRequestInterceptor.java
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
similarity index 93%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
index cc42085927..f9497fa925 100644
--- 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/ResponseExtractorFutureInstrumentation.java
@@ -41,7 +41,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
  * {@link ResponseCallBackInterceptor} set the {@link URI} and {@link 
ContextSnapshot} to inherited
  * <code>org.springframework.util.concurrent.SuccessCallback</code> and 
<code>org.springframework.util.concurrent.FailureCallback</code>
  */
-public class ResponseExtractorFutureInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
+public abstract class ResponseExtractorFutureInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
 
     private static final String ADD_CALLBACK_METHOD_NAME = "addCallback";
     private static final String ADD_CALLBACK_INTERCEPTOR = 
"org.apache.skywalking.apm.plugin.spring.resttemplate.async.ResponseCallBackInterceptor";
@@ -97,11 +97,4 @@ public class ResponseExtractorFutureInstrumentation extends 
ClassInstanceMethods
     protected ClassMatch enhanceClass() {
         return NameMatch.byName(ENHANCE_CLASS);
     }
-
-    @Override
-    protected String[] witnessClasses() {
-        return new String[] {
-            
"org.springframework.web.context.support.ServletContextAttributeFactoryBean"
-        };
-    }
 }
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
similarity index 93%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
index c0722f8326..d7e9145248 100644
--- 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/async/define/RestTemplateInstrumentation.java
@@ -39,7 +39,7 @@ import static net.bytebuddy.matcher.ElementMatchers.named;
  * 
<code>org.springframework.web.client.AsyncRestTemplate$ResponseExtractorFuture</code>
 for propagate trace context
  * after execute <code>doExecute</code> .
  */
-public class RestTemplateInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
+public abstract class RestTemplateInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
 
     private static final String ENHANCE_CLASS = 
"org.springframework.web.client.AsyncRestTemplate";
     private static final String DO_EXECUTE_METHOD_NAME = "doExecute";
@@ -94,11 +94,4 @@ public class RestTemplateInstrumentation extends 
ClassInstanceMethodsEnhancePlug
     protected ClassMatch enhanceClass() {
         return NameMatch.byName(ENHANCE_CLASS);
     }
-
-    @Override
-    protected String[] witnessClasses() {
-        return new String[] {
-            
"org.springframework.web.context.support.ServletContextAttributeFactoryBean"
-        };
-    }
 }
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/helper/RestTemplateRuntimeContextHelper.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/helper/RestTemplateRuntimeContextHelper.java
similarity index 100%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/helper/RestTemplateRuntimeContextHelper.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/helper/RestTemplateRuntimeContextHelper.java
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java
similarity index 100%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestExecuteInterceptor.java
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java
similarity index 100%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestRequestInterceptor.java
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java
similarity index 100%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/RestResponseInterceptor.java
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
similarity index 94%
rename from 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
rename to 
apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
index 9c98b81c50..8089e2a7b7 100644
--- 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/resttemplate-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/sync/define/RestTemplateInstrumentation.java
@@ -38,7 +38,7 @@ import static 
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName
  * <code>RestResponseInterceptor</code> set context to  header for
  * propagate trace context after execute <code>createRequest</code>.
  */
-public class RestTemplateInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
+public abstract class RestTemplateInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
 
     private static final String ENHANCE_CLASS = 
"org.springframework.web.client.RestTemplate";
     private static final String DO_EXECUTE_METHOD_NAME = "doExecute";
@@ -111,11 +111,4 @@ public class RestTemplateInstrumentation extends 
ClassInstanceMethodsEnhancePlug
     protected ClassMatch enhanceClass() {
         return byName(ENHANCE_CLASS);
     }
-
-    @Override
-    protected String[] witnessClasses() {
-        return new String[] {
-            
"org.springframework.web.context.support.ServletContextAttributeFactoryBean"
-        };
-    }
 }
diff --git 
a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
 
b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
index c9fdb3823d..2c22415b4e 100644
--- 
a/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
+++ 
b/apm-sniffer/optional-plugins/optional-spring-plugins/resttemplate-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/resttemplate/v6x/sync/define/RestTemplateInstrumentation.java
@@ -26,6 +26,7 @@ import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterc
 import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
 
 import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
 import static 
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
 
 /**
@@ -59,7 +60,9 @@ public class RestTemplateInstrumentation extends 
ClassInstanceMethodsEnhancePlug
             new InstanceMethodsInterceptPoint() {
                 @Override
                 public ElementMatcher<MethodDescription> getMethodsMatcher() {
-                    return named(DO_EXECUTE_METHOD_NAME);
+                    return named(DO_EXECUTE_METHOD_NAME)
+                            .and(takesArgument(0, named("java.net.URI")))
+                            .and(takesArgument(2, 
named("org.springframework.http.HttpMethod")));
                 }
 
                 @Override
@@ -115,7 +118,7 @@ public class RestTemplateInstrumentation extends 
ClassInstanceMethodsEnhancePlug
     @Override
     protected String[] witnessClasses() {
         return new String[] {
-            "org.springframework.web.client.ClientHttpResponseDecorator"
+            "org.springframework.http.client.reactive.JdkClientHttpConnector"
         };
     }
 }

Reply via email to