This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new a7ec3f166 [Task] Sdk http example(#3925) (#4159)
a7ec3f166 is described below
commit a7ec3f1669254596eecdc014717024c20ed78b02
Author: 杨文杰 <[email protected]>
AuthorDate: Mon Nov 7 13:38:56 2022 +0800
[Task] Sdk http example(#3925) (#4159)
* init
* add shenyu sdk http
* add shenyu sdk http
* add shenyu sdk http script and Dockerfile
---
shenyu-examples/pom.xml | 1 +
.../pom.xml | 5 +
shenyu-examples/shenyu-examples-sdk/pom.xml | 69 ++++++++++++
.../shenyu-examples-sdk-http/Dockerfile | 29 +++++
.../shenyu-examples-sdk-http/pom.xml | 121 +++++++++++++++++++++
.../src/main/http/sdk-http-test-api.http | 33 ++++++
.../sdk/http/ShenyuSdkHttpExampleApplication.java | 39 +++++++
.../examples/sdk/http/api/ShenyuHttpClientApi.java | 58 ++++++++++
.../sdk/http/controller/HttpServiceController.java | 73 +++++++++++++
.../controller/ShenyuHttpSdkExampleController.java | 62 +++++++++++
.../shenyu/examples/sdk/http/dto/SdkTestDto.java | 64 +++++++++++
.../src/main/resources/application.yaml | 52 +++++++++
12 files changed, 606 insertions(+)
diff --git a/shenyu-examples/pom.xml b/shenyu-examples/pom.xml
index 08bd4d62b..135adfe4f 100644
--- a/shenyu-examples/pom.xml
+++ b/shenyu-examples/pom.xml
@@ -55,6 +55,7 @@
<module>shenyu-examples-websocket</module>
<module>shenyu-examples-springmvc</module>
<module>shenyu-examples-springmvc-tomcat</module>
+ <module>shenyu-examples-sdk</module>
</modules>
<build>
diff --git
a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service-xml/pom.xml
b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service-xml/pom.xml
index 48c408422..6330d93e1 100644
---
a/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service-xml/pom.xml
+++
b/shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service-xml/pom.xml
@@ -128,6 +128,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-examples-dubbo-api</artifactId>
+ <version>2.5.1-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
diff --git a/shenyu-examples/shenyu-examples-sdk/pom.xml
b/shenyu-examples/shenyu-examples-sdk/pom.xml
new file mode 100644
index 000000000..8474393ad
--- /dev/null
+++ b/shenyu-examples/shenyu-examples-sdk/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>shenyu-examples</artifactId>
+ <groupId>org.apache.shenyu</groupId>
+ <version>2.5.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-examples-sdk</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>shenyu-examples-sdk-http</module>
+ </modules>
+
+ <properties>
+ <shenyu-sdk.version>2.5.1-SNAPSHOT</shenyu-sdk.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-sdk-core</artifactId>
+ <version>${shenyu-sdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-sdk-spring</artifactId>
+ <version>${shenyu-sdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-sdk-httpclient</artifactId>
+ <version>${shenyu-sdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-sdk-okhttp</artifactId>
+ <version>${shenyu-sdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-sdk</artifactId>
+ <version>${shenyu-sdk.version}</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+</project>
\ No newline at end of file
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/Dockerfile
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/Dockerfile
new file mode 100644
index 000000000..52e74e05f
--- /dev/null
+++ b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/Dockerfile
@@ -0,0 +1,29 @@
+# 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.
+
+FROM openjdk:8-jre-alpine
+
+ENV APP_NAME shenyu-examples-sdk-http
+ENV LOCAL_PATH /opt/${APP_NAME}
+
+RUN mkdir -p ${LOCAL_PATH}
+
+ADD target/${APP_NAME}.jar ${LOCAL_PATH}
+
+WORKDIR ${LOCAL_PATH}
+EXPOSE 8899
+
+CMD java -jar ${APP_NAME}.jar
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
new file mode 100644
index 000000000..bbe1f74d1
--- /dev/null
+++ b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/pom.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>shenyu-examples-sdk</artifactId>
+ <groupId>org.apache.shenyu</groupId>
+ <version>2.5.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>shenyu-examples-sdk-http</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-sdk-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-sdk-httpclient</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <!--spring bootstrap-->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-sdk</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shenyu</groupId>
+
<artifactId>shenyu-spring-boot-starter-client-springmvc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>shenyu-examples-sdk-http</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+
<mainClass>org.apache.shenyu.examples.sdk.http.ShenyuSdkHttpExampleApplication</mainClass>
+ <executable>true</executable>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>example</id>
+ <properties>
+
<docker.buildArg.APP_NAME>shenyu-examples-sdk-http</docker.buildArg.APP_NAME>
+
<docker.image.tag.repo>shenyu-examples-sdk-http</docker.image.tag.repo>
+ <docker.image.tag.tagName>latest</docker.image.tag.tagName>
+ </properties>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>${docker-maven-plugin.version}</version>
+ <configuration>
+ <images>
+ <image>
+ <name>shenyu-examples-sdk-http</name>
+ <build>
+
<contextDir>${project.basedir}</contextDir>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/http/sdk-http-test-api.http
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/http/sdk-http-test-api.http
new file mode 100644
index 000000000..f2e3be4e9
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/http/sdk-http-test-api.http
@@ -0,0 +1,33 @@
+#
+# 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.
+#
+
+
+### shengyu sdk http findById
+GET http://localhost:8899/sdk/findById?id=1
+Accept: application/json
+Content-Type: application/json
+
+### shengyu sdk annoTest
+POST http://localhost:8899/sdk/annoTest
+Accept: application/json
+Content-Type: application/json
+
+{
+ "id" : "10",
+ "name" : "name_test"
+}
+
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
new file mode 100644
index 000000000..50a0f0e0e
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/ShenyuSdkHttpExampleApplication.java
@@ -0,0 +1,39 @@
+/*
+ * 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.shenyu.examples.sdk.http;
+
+import org.apache.shenyu.sdk.spring.EnableShenyuClients;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * ShenyuSdkHttpExampleApplication.
+ */
+@SpringBootApplication
+@EnableShenyuClients(basePackages =
{"org.apache.shenyu.examples.sdk.http.api"})
+public class ShenyuSdkHttpExampleApplication {
+
+ /**
+ * main.
+ *
+ * @param args args
+ */
+ public static void main(final String[] args) {
+ SpringApplication.run(ShenyuSdkHttpExampleApplication.class, args);
+ }
+}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/api/ShenyuHttpClientApi.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/api/ShenyuHttpClientApi.java
new file mode 100644
index 000000000..4d77f2566
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/api/ShenyuHttpClientApi.java
@@ -0,0 +1,58 @@
+/*
+ * 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.shenyu.examples.sdk.http.api;
+
+import org.apache.shenyu.examples.sdk.http.dto.SdkTestDto;
+import org.apache.shenyu.sdk.spring.ShenyuClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.CookieValue;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * ShenyuHttpClientApi.
+ */
+@ShenyuClient(contextId = "shenyu-gateway", name = "ShenyuSdkApiName")
+public interface ShenyuHttpClientApi {
+
+ /**
+ * findById.
+ * test Get.
+ *
+ * @param id id
+ * @return SdkTestDto
+ */
+ @GetMapping("/http/shenyu/client/findById")
+ SdkTestDto findById(@RequestParam("id") String id);
+
+ /**
+ * annoTest.
+ *
+ * @param cookie cookie
+ * @param header header
+ * @param id id
+ * @param requestDto requestDto
+ * @return sdkTestDto
+ */
+ @PostMapping("/http/shenyu/client/{id}/anno")
+ SdkTestDto annoTest(@CookieValue("cookie") String cookie,
@RequestHeader("header") String header, @PathVariable("id") String id,
@RequestBody SdkTestDto requestDto);
+
+}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/HttpServiceController.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/HttpServiceController.java
new file mode 100644
index 000000000..18897991e
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/HttpServiceController.java
@@ -0,0 +1,73 @@
+/*
+ * 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.shenyu.examples.sdk.http.controller;
+
+import org.apache.shenyu.client.springmvc.annotation.ShenyuSpringMvcClient;
+import org.apache.shenyu.examples.sdk.http.dto.SdkTestDto;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.CookieValue;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * HttpServiceController.
+ */
+@RestController
+public class HttpServiceController {
+
+ private static final String HELLO_SUFFIX = "I'm Shenyu-Gateway System.
Welcome!";
+
+ /**
+ * findById.
+ *
+ * @param id id
+ * @return SdkTestDto.
+ */
+ @GetMapping("shenyu/client/findById")
+ @ShenyuSpringMvcClient("shenyu/client/findById")
+ public SdkTestDto findById(final @RequestParam("id") String id) {
+ SdkTestDto sdkTestDto = new SdkTestDto();
+ sdkTestDto.setId(id);
+ sdkTestDto.setName("sdk");
+ return sdkTestDto;
+ }
+
+ /**
+ * annoTest.
+ *
+ * @param cookie cookie
+ * @param header header
+ * @param id id
+ * @param requestDto requestDto
+ * @return SdkTestDto
+ */
+ @PostMapping("/shenyu/client/{id}/anno")
+ @ShenyuSpringMvcClient("/shenyu/client/**/anno")
+ public SdkTestDto annoTest(final @CookieValue("cookie") String cookie,
final @RequestHeader("header") String header,
+ final @PathVariable("id") String id, final
@RequestBody SdkTestDto requestDto) {
+ SdkTestDto sdkTestDto = new SdkTestDto();
+ sdkTestDto.setName("name=" + requestDto.getName() + ",Cookie=" +
cookie + ",header=" + header);
+ sdkTestDto.setId(id);
+ return sdkTestDto;
+ }
+
+}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/ShenyuHttpSdkExampleController.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/ShenyuHttpSdkExampleController.java
new file mode 100644
index 000000000..1ac98a0f0
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/controller/ShenyuHttpSdkExampleController.java
@@ -0,0 +1,62 @@
+/*
+ * 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.shenyu.examples.sdk.http.controller;
+
+import org.apache.shenyu.examples.sdk.http.api.ShenyuHttpClientApi;
+import org.apache.shenyu.examples.sdk.http.dto.SdkTestDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.PostMapping;
+
+/**
+ * ShenyuHttpSdkExampleController.
+ * invoke shenyuSdkAPi
+ */
+@RestController
+public class ShenyuHttpSdkExampleController {
+
+ @Autowired
+ private ShenyuHttpClientApi shenyuHttpClientApi;
+
+ /**
+ * findById.
+ *
+ * @param id id
+ * @return SdkTestDto
+ */
+ @GetMapping("sdk/findById")
+ public SdkTestDto findById(final @RequestParam("id") String id) {
+ return shenyuHttpClientApi.findById(id);
+ }
+
+ /**
+ * annoTest.
+ * test anno support shenyu SDK.
+ *
+ * @param sdkTestDto sdkTestDto
+ * @return sdkTestDto
+ */
+ @PostMapping("sdk/annoTest")
+ public SdkTestDto annoTest(final @RequestBody SdkTestDto sdkTestDto) {
+ return shenyuHttpClientApi.annoTest("cookie", "header", "9",
sdkTestDto);
+ }
+
+}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/dto/SdkTestDto.java
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/dto/SdkTestDto.java
new file mode 100644
index 000000000..9ebba66a5
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/java/org/apache/shenyu/examples/sdk/http/dto/SdkTestDto.java
@@ -0,0 +1,64 @@
+/*
+ * 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.shenyu.examples.sdk.http.dto;
+
+/**
+ * SdkTestDto.
+ */
+public class SdkTestDto {
+
+ private String id;
+
+ private String name;
+
+ /**
+ * getId.
+ *
+ * @return id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * setId.
+ *
+ * @param id id
+ */
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ /**
+ * getName.
+ *
+ * @return name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * setName.
+ *
+ * @param name name
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
diff --git
a/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/resources/application.yaml
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/resources/application.yaml
new file mode 100644
index 000000000..75c18b50f
--- /dev/null
+++
b/shenyu-examples/shenyu-examples-sdk/shenyu-examples-sdk-http/src/main/resources/application.yaml
@@ -0,0 +1,52 @@
+# 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.
+server:
+ port: 8899
+ address: 0.0.0.0
+ tomcat:
+ max-http-form-post-size: 100MB
+
+shenyu:
+ register:
+ registerType: http #zookeeper #etcd #nacos #consul
+ serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379
#localhost:8848
+ props:
+ username: admin
+ password: 123456
+ client:
+ http:
+ props:
+ contextPath: /http
+ appName: http
+ # port: 8189
+ sdk:
+ enabled: true
+ register-type: zookeeper #local #etcd #nacos #consul
+ server-lists: localhost:2181 #http://localhost:9095 #http://localhost:2379
#localhost:8848
+
+spring:
+ servlet:
+ multipart:
+ max-file-size: 100MB
+ max-request-size: 100MB
+
+logging:
+ level:
+ root: info
+ org.springframework.boot: info
+ org.apache.ibatis: info
+ org.apache.shenyu.test.bonuspoint: info
+ org.apache.shenyu.test.lottery: debug
+ org.apache.shenyu.test: debug