This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 0cf89cb49 Add triple rest example (#1083)
0cf89cb49 is described below
commit 0cf89cb4997b742201362b1ea635cc9166af8d96
Author: Ken Liu <[email protected]>
AuthorDate: Tue Mar 19 09:50:51 2024 +0800
Add triple rest example (#1083)
---
.../dubbo-samples-dubbo/README.md | 0
.../dubbo-samples-dubbo-consumer/pom.xml | 0
.../dubbo/demo/consumer/ConsumerApplication.java | 0
.../dubbo/protocol/dubbo/demo/consumer/Task.java | 0
.../src/main/resources/application.yml | 0
.../dubbo-samples-dubbo-interface/pom.xml | 0
.../dubbo/protocol/dubbo/demo/DemoService.java | 0
.../dubbo-samples-dubbo-provider/pom.xml | 0
.../dubbo/demo/provider/DemoServiceImpl.java | 0
.../dubbo/demo/provider/ProviderApplication.java | 0
.../src/main/resources/application.yml | 0
.../dubbo-samples-dubbo/pom.xml | 0
.../dubbo-samples-triple-rest-jaxrs/README.md | 34 +++++++++++++
.../case-configuration.yml | 32 ++++++++++--
.../case-versions.conf | 25 ++++++++++
.../dubbo-samples-triple-rest-jaxrs}/pom.xml | 27 +++++++---
.../org/apache/dubbo/rest}/demo/DemoService.java | 13 ++++-
.../dubbo/rest/demo/JaxrsRestApplication.java | 6 +--
.../org/apache/dubbo/rest}/demo/consumer/Task.java | 27 +++++-----
.../dubbo/rest}/demo/provider/DemoServiceImpl.java | 6 +--
.../src/main/resources/application.yml | 12 +++--
.../dubbo/rest/demo/test}/ConsumerApplication.java | 2 +-
.../apache/dubbo/rest/demo/test/ConsumerIT.java | 55 +++++++++++++++++++++
.../dubbo-samples-triple-rest-springmvc/README.md | 34 +++++++++++++
.../case-configuration.yml | 32 ++++++++++--
.../case-versions.conf | 25 ++++++++++
.../dubbo-samples-triple-rest-springmvc}/pom.xml | 29 ++++++++---
.../org/apache/dubbo/rest}/demo/DemoService.java | 12 ++++-
.../dubbo/rest/demo/SpringmvcRestApplication.java | 6 +--
.../org/apache/dubbo/rest}/demo/consumer/Task.java | 27 +++++-----
.../dubbo/rest}/demo/provider/DemoServiceImpl.java | 6 +--
.../src/main/resources/application.yml | 12 +++--
.../dubbo/rest/demo/test}/ConsumerApplication.java | 2 +-
.../apache/dubbo/rest/demo/test/ConsumerIT.java | 57 ++++++++++++++++++++++
.../dubbo-samples-triple-rest}/pom.xml | 40 ++++++++++-----
2-advanced/pom.xml | 2 +
3-extensions/protocol/pom.xml | 1 -
37 files changed, 436 insertions(+), 88 deletions(-)
diff --git a/3-extensions/protocol/dubbo-samples-dubbo/README.md
b/2-advanced/dubbo-samples-dubbo/README.md
similarity index 100%
rename from 3-extensions/protocol/dubbo-samples-dubbo/README.md
rename to 2-advanced/dubbo-samples-dubbo/README.md
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
similarity index 100%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
copy to 2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
similarity index 100%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
copy to
2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
similarity index 100%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
copy to
2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
similarity index 100%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
copy to
2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/pom.xml
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/pom.xml
similarity index 100%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/pom.xml
rename to 2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/pom.xml
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
similarity index 100%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
copy to
2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/pom.xml
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/pom.xml
similarity index 100%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/pom.xml
rename to 2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/pom.xml
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
similarity index 100%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
copy to
2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
similarity index 100%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
copy to
2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
b/2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
similarity index 100%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
copy to
2-advanced/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
diff --git a/3-extensions/protocol/dubbo-samples-dubbo/pom.xml
b/2-advanced/dubbo-samples-dubbo/pom.xml
similarity index 100%
copy from 3-extensions/protocol/dubbo-samples-dubbo/pom.xml
copy to 2-advanced/dubbo-samples-dubbo/pom.xml
diff --git
a/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/README.md
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/README.md
new file mode 100644
index 000000000..71b97068a
--- /dev/null
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/README.md
@@ -0,0 +1,34 @@
+# Dubbo Triple Rest JAX-RS Example
+
+This example shows how to use Spring Web annotation to add rest-style access
to triple protocol.
+
+# How to run
+
+## Start Zookeeper
+This example replies on Zookeeper(3.8.0+) as service discovery registry
center, so you need to run the Zookeeper server first, there are two ways to do
so:
+1. [Download zookeeper binary and start it
directly](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/zookeeper/#本地下载)
+2. [Start zookeeper using
docker](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/zookeeper/#docker)
+
+## Install dependencies
+Step into 'dubbo-samples-triple-rest' directory, run the following command:
+
+```shell
+$ mvn clean install
+```
+
+## Start provider
+Step into 'dubbo-samples-triple-rest-jaxrs' directory
+
+then, run the following command to start application:
+```shell
+$ mvn compile exec:java
-Dexec.mainClass="org.apache.dubbo.rest.demo.JaxrsRestApplication"
+```
+
+Run the following command to see server works as expected:
+```shell
+curl \
+ --header "Content-Type: application/json" \
+ 'http://localhost:50052/demo/hello?name=world'
+```
+
+Or, you can visit the following link by using web browser:
`http://localhost:50052/demo/hello?name=world`
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/case-configuration.yml
similarity index 52%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
copy to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/case-configuration.yml
index 5fc8b6572..5352a8e45 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/case-configuration.yml
@@ -14,6 +14,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-dubbo:
- application:
- name: dubbo-protocol-consumer
+services:
+ zookeeper:
+ image: zookeeper:latest
+
+ jaxrs-provider:
+ type: app
+ basedir: dubbo-samples-triple-rest-jaxrs
+ mainClass: org.apache.dubbo.rest.demo.SpringmvcRestApplication
+ systemProps:
+ - zookeeper.address=zookeeper
+ waitPortsBeforeRun:
+ - zookeeper:2181
+ checkPorts:
+ - 50052
+ checkLog: "Current Spring Boot Application is await..."
+
+ test:
+ type: test
+ basedir: dubbo-samples-triple-rest-jaxrs
+ tests:
+ - "**/*IT.class"
+ systemProps:
+ - zookeeper.address=zookeeper
+ - dubbo.address=jaxrs-provider:50052
+ waitPortsBeforeRun:
+ - zookeeper:2181
+ - jaxrs-provider:50052
+ depends_on:
+ - jaxrs-provider
diff --git
a/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/case-versions.conf
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/case-versions.conf
new file mode 100644
index 000000000..b85ce1582
--- /dev/null
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/case-versions.conf
@@ -0,0 +1,25 @@
+#
+#
+# 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.
+#
+
+
+# Supported component versions of the test case
+
+# Spring app
+dubbo.version=3.3.0.*
+spring.version=6.*
+java.version= [>= 17]
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/pom.xml
similarity index 76%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
copy to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/pom.xml
index cf997bf1f..ceae6d947 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/pom.xml
@@ -18,28 +18,34 @@
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>dubbo-samples-dubbo</artifactId>
+ <artifactId>dubbo-samples-triple-rest</artifactId>
<groupId>org.apache.dubbo</groupId>
<version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>dubbo-samples-dubbo-consumer</artifactId>
+ <artifactId>dubbo-samples-triple-rest-jaxrs</artifactId>
<dependencies>
+ <!-- dubbo -->
<dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-samples-dubbo-interface</artifactId>
- <version>${project.parent.version}</version>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
-
- <!-- dubbo -->
<dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-spring-boot-starter</artifactId>
+
<artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId>
</dependency>
- <!-- spring starter -->
+ <!-- spring web annotation support -->
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.1.1</version>
+ </dependency>
+
+ <!-- spring boot starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
@@ -55,6 +61,11 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/DemoService.java
similarity index 77%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
copy to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/DemoService.java
index aab023edd..c2379472d 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/DemoService.java
@@ -14,9 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo;
+package org.apache.dubbo.rest.demo;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+@Path("/demo")
public interface DemoService {
- String sayHello(String name);
+ @GET
+ @Path("/hello")
+ String sayHello(@QueryParam("name") String name);
+
+ // add more methods
}
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/JaxrsRestApplication.java
similarity index 87%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
copy to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/JaxrsRestApplication.java
index c403d5476..a4430cc9d 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/JaxrsRestApplication.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo.provider;
+package org.apache.dubbo.rest.demo;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
@@ -24,8 +24,8 @@ import
org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableDubbo
-public class ProviderApplication {
+public class JaxrsRestApplication {
public static void main(String[] args) {
- SpringApplication.run(ProviderApplication.class, args);
+ SpringApplication.run(JaxrsRestApplication.class, args);
}
}
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/consumer/Task.java
similarity index 66%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
copy to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/consumer/Task.java
index 90e90e583..e2bffb41d 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/consumer/Task.java
@@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo.consumer;
+package org.apache.dubbo.rest.demo.consumer;
import java.util.Date;
import org.apache.dubbo.config.annotation.DubboReference;
-import org.apache.dubbo.protocol.dubbo.demo.DemoService;
+import org.apache.dubbo.rest.demo.DemoService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class Task implements CommandLineRunner {
- @DubboReference(url =
"dubbo://127.0.0.1:20880/org.apache.dubbo.protocol.dubbo.demo.DemoService")
+ @DubboReference
private DemoService demoService;
@Override
@@ -33,16 +33,15 @@ public class Task implements CommandLineRunner {
String result = demoService.sayHello("world");
System.out.println("Receive result ======> " + result);
- new Thread(()-> {
- while (true) {
- try {
- Thread.sleep(1000);
- System.out.println(new Date() + " Receive result ======> "
+ demoService.sayHello("world"));
- } catch (InterruptedException e) {
- e.printStackTrace();
- Thread.currentThread().interrupt();
- }
- }
- }).start();
+
+ try {
+ Thread.sleep(1000);
+ System.out.println(new Date() + " Receive result ======> " +
demoService.sayHello("world"));
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ Thread.currentThread().interrupt();
+ }
+
+
}
}
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/provider/DemoServiceImpl.java
similarity index 90%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
copy to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/provider/DemoServiceImpl.java
index 56dae497f..d90361577 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/java/org/apache/dubbo/rest/demo/provider/DemoServiceImpl.java
@@ -14,11 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo.provider;
-
+package org.apache.dubbo.rest.demo.provider;
import org.apache.dubbo.config.annotation.DubboService;
-import org.apache.dubbo.protocol.dubbo.demo.DemoService;
+import org.apache.dubbo.rest.demo.DemoService;
@DubboService
public class DemoServiceImpl implements DemoService {
@@ -27,4 +26,5 @@ public class DemoServiceImpl implements DemoService {
public String sayHello(String name) {
return "Hello " + name;
}
+
}
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/resources/application.yml
similarity index 80%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
copy to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/resources/application.yml
index 790c2b4a8..b10439d00 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/main/resources/application.yml
@@ -13,10 +13,14 @@
# 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: 8081
dubbo:
application:
- name: dubbo-protocol-provider
+ name: dubbo-springboot-triple-rest-jaxrs
+ qos-port: 33333
+ registry:
+ address: zookeeper://${zookeeper.address:127.0.0.1}:2181
protocol:
- name: dubbo
- port: 20880
+ name: tri
+ port: 50052
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerApplication.java
similarity index 95%
copy from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
copy to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerApplication.java
index 4d6be7381..1a58d8415 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerApplication.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo.consumer;
+package org.apache.dubbo.rest.demo.test;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
diff --git
a/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerIT.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerIT.java
new file mode 100644
index 000000000..1dcff3c0b
--- /dev/null
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-jaxrs/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerIT.java
@@ -0,0 +1,55 @@
+/*
+ * 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.dubbo.rest.demo.test;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.rest.demo.DemoService;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.client.RestClient;
+
+@SpringBootTest
+@RunWith(SpringRunner.class)
+public class ConsumerIT {
+
+ private static final String providerAddress =
System.getProperty("dubbo.address", "localhost");
+
+ @DubboReference
+ private DemoService demoService;
+
+ @Test
+ public void test() {
+ String result = demoService.sayHello("world");
+ Assert.assertEquals("Hello world", result);
+ }
+
+ @Test
+ public void testRest() {
+ RestClient defaultClient = RestClient.create();
+ ResponseEntity<String> result = defaultClient.get()
+ .uri("http://" + providerAddress +
":50052/demo/hello?name=world")
+ .header("Content-type", "application/json")
+ .retrieve()
+ .toEntity(String.class);
+ // FIXME
+ Assert.assertEquals("\"Hello world\"", result.getBody());
+ }
+}
diff --git
a/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/README.md
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/README.md
new file mode 100644
index 000000000..bec255d29
--- /dev/null
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/README.md
@@ -0,0 +1,34 @@
+# Dubbo Triple Rest Spring Web Example
+
+This example shows how to use Spring Web annotation to add rest-style access
to triple protocol.
+
+# How to run
+
+## Start Zookeeper
+This example replies on Zookeeper(3.8.0+) as service discovery registry
center, so you need to run the Zookeeper server first, there are two ways to do
so:
+1. [Download zookeeper binary and start it
directly](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/zookeeper/#本地下载)
+2. [Start zookeeper using
docker](https://dubbo-next.staged.apache.org/zh-cn/overview/reference/integrations/zookeeper/#docker)
+
+## Install dependencies
+Step into 'dubbo-samples-triple-rest' directory, run the following command:
+
+```shell
+$ mvn clean install
+```
+
+## Start provider
+Step into 'dubbo-samples-triple-rest-springmvc' directory
+
+then, run the following command to start application:
+```shell
+$ mvn compile exec:java
-Dexec.mainClass="org.apache.dubbo.rest.demo.SpringmvcRestApplication"
+```
+
+Run the following command to see server works as expected:
+```shell
+curl \
+ --header "Content-Type: application/json" \
+ 'http://localhost:50052/demo/hello?name=world'
+```
+
+Or, you can visit the following link by using web browser:
`http://localhost:50052/demo/hello?name=world`
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/case-configuration.yml
similarity index 52%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
rename to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/case-configuration.yml
index 5fc8b6572..34ff633e2 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/resources/application.yml
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/case-configuration.yml
@@ -14,6 +14,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-dubbo:
- application:
- name: dubbo-protocol-consumer
+services:
+ zookeeper:
+ image: zookeeper:latest
+
+ springmvc-provider:
+ type: app
+ basedir: dubbo-samples-triple-rest-springmvc
+ mainClass: org.apache.dubbo.rest.demo.SpringmvcRestApplication
+ systemProps:
+ - zookeeper.address=zookeeper
+ waitPortsBeforeRun:
+ - zookeeper:2181
+ checkPorts:
+ - 50052
+ checkLog: "Current Spring Boot Application is await..."
+
+ test:
+ type: test
+ basedir: dubbo-samples-triple-rest-springmvc
+ tests:
+ - "**/*IT.class"
+ systemProps:
+ - zookeeper.address=zookeeper
+ - dubbo.address=springmvc-provider
+ waitPortsBeforeRun:
+ - zookeeper:2181
+ - springmvc-provider:50052
+ depends_on:
+ - springmvc-provider
diff --git
a/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/case-versions.conf
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/case-versions.conf
new file mode 100644
index 000000000..b85ce1582
--- /dev/null
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/case-versions.conf
@@ -0,0 +1,25 @@
+#
+#
+# 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.
+#
+
+
+# Supported component versions of the test case
+
+# Spring app
+dubbo.version=3.3.0.*
+spring.version=6.*
+java.version= [>= 17]
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/pom.xml
similarity index 74%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
rename to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/pom.xml
index cf997bf1f..21eb16029 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/pom.xml
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/pom.xml
@@ -18,28 +18,41 @@
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>dubbo-samples-dubbo</artifactId>
+ <artifactId>dubbo-samples-triple-rest</artifactId>
<groupId>org.apache.dubbo</groupId>
<version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>dubbo-samples-dubbo-consumer</artifactId>
+ <artifactId>dubbo-samples-triple-rest-springmvc</artifactId>
<dependencies>
+ <!-- dubbo -->
<dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-samples-dubbo-interface</artifactId>
- <version>${project.parent.version}</version>
+ <artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
-
- <!-- dubbo -->
<dependency>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-spring-boot-starter</artifactId>
+
<artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId>
+ </dependency>
+
+ <!-- spring web annotation support -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.alibaba.spring</groupId>
+ <artifactId>spring-context-support</artifactId>
</dependency>
- <!-- spring starter -->
+ <!-- spring boot starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/DemoService.java
similarity index 67%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
rename to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/DemoService.java
index aab023edd..ee849e9c2 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-interface/src/main/java/org/apache/dubbo/protocol/dubbo/demo/DemoService.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/DemoService.java
@@ -14,9 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo;
+package org.apache.dubbo.rest.demo;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RequestMapping("/demo")
public interface DemoService {
- String sayHello(String name);
+ @RequestMapping(method = RequestMethod.GET, value = "/hello")
+ String sayHello(@RequestParam("name") String name);
+
+ // add more methods
}
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/SpringmvcRestApplication.java
similarity index 87%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
rename to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/SpringmvcRestApplication.java
index c403d5476..154f569d5 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/ProviderApplication.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/SpringmvcRestApplication.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo.provider;
+package org.apache.dubbo.rest.demo;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
@@ -24,8 +24,8 @@ import
org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableDubbo
-public class ProviderApplication {
+public class SpringmvcRestApplication {
public static void main(String[] args) {
- SpringApplication.run(ProviderApplication.class, args);
+ SpringApplication.run(SpringmvcRestApplication.class, args);
}
}
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/consumer/Task.java
similarity index 66%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
rename to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/consumer/Task.java
index 90e90e583..e2bffb41d 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/Task.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/consumer/Task.java
@@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo.consumer;
+package org.apache.dubbo.rest.demo.consumer;
import java.util.Date;
import org.apache.dubbo.config.annotation.DubboReference;
-import org.apache.dubbo.protocol.dubbo.demo.DemoService;
+import org.apache.dubbo.rest.demo.DemoService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class Task implements CommandLineRunner {
- @DubboReference(url =
"dubbo://127.0.0.1:20880/org.apache.dubbo.protocol.dubbo.demo.DemoService")
+ @DubboReference
private DemoService demoService;
@Override
@@ -33,16 +33,15 @@ public class Task implements CommandLineRunner {
String result = demoService.sayHello("world");
System.out.println("Receive result ======> " + result);
- new Thread(()-> {
- while (true) {
- try {
- Thread.sleep(1000);
- System.out.println(new Date() + " Receive result ======> "
+ demoService.sayHello("world"));
- } catch (InterruptedException e) {
- e.printStackTrace();
- Thread.currentThread().interrupt();
- }
- }
- }).start();
+
+ try {
+ Thread.sleep(1000);
+ System.out.println(new Date() + " Receive result ======> " +
demoService.sayHello("world"));
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ Thread.currentThread().interrupt();
+ }
+
+
}
}
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/provider/DemoServiceImpl.java
similarity index 90%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
rename to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/provider/DemoServiceImpl.java
index 56dae497f..d90361577 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/java/org/apache/dubbo/protocol/dubbo/demo/provider/DemoServiceImpl.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/java/org/apache/dubbo/rest/demo/provider/DemoServiceImpl.java
@@ -14,11 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo.provider;
-
+package org.apache.dubbo.rest.demo.provider;
import org.apache.dubbo.config.annotation.DubboService;
-import org.apache.dubbo.protocol.dubbo.demo.DemoService;
+import org.apache.dubbo.rest.demo.DemoService;
@DubboService
public class DemoServiceImpl implements DemoService {
@@ -27,4 +26,5 @@ public class DemoServiceImpl implements DemoService {
public String sayHello(String name) {
return "Hello " + name;
}
+
}
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/resources/application.yml
similarity index 80%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
rename to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/resources/application.yml
index 790c2b4a8..47b28603a 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-provider/src/main/resources/application.yml
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/main/resources/application.yml
@@ -13,10 +13,14 @@
# 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: 8081
dubbo:
application:
- name: dubbo-protocol-provider
+ name: dubbo-springboot-triple-rest-springmvc
+ qos-port: 33333
+ registry:
+ address: zookeeper://${zookeeper.address:127.0.0.1}:2181
protocol:
- name: dubbo
- port: 20880
+ name: tri
+ port: 50052
diff --git
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerApplication.java
similarity index 95%
rename from
3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
rename to
2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerApplication.java
index 4d6be7381..1a58d8415 100644
---
a/3-extensions/protocol/dubbo-samples-dubbo/dubbo-samples-dubbo-consumer/src/main/java/org/apache/dubbo/protocol/dubbo/demo/consumer/ConsumerApplication.java
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerApplication.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.dubbo.protocol.dubbo.demo.consumer;
+package org.apache.dubbo.rest.demo.test;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
diff --git
a/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerIT.java
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerIT.java
new file mode 100644
index 000000000..38646cabc
--- /dev/null
+++
b/2-advanced/dubbo-samples-triple-rest/dubbo-samples-triple-rest-springmvc/src/test/java/org/apache/dubbo/rest/demo/test/ConsumerIT.java
@@ -0,0 +1,57 @@
+/*
+ * 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.dubbo.rest.demo.test;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.rest.demo.DemoService;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.client.RestClient;
+import org.springframework.web.client.RestTemplate;
+
+import static org.springframework.http.MediaType.APPLICATION_JSON;
+
+@SpringBootTest
+@RunWith(SpringRunner.class)
+public class ConsumerIT {
+ private static final String providerAddress =
System.getProperty("dubbo.address", "localhost");
+
+ @DubboReference
+ private DemoService demoService;
+
+ @Test
+ public void test() {
+ String result = demoService.sayHello("world");
+ Assert.assertEquals("Hello world", result);
+ }
+
+ @Test
+ public void testRest() {
+ RestClient defaultClient = RestClient.create();
+ ResponseEntity<String> result = defaultClient.get()
+ .uri("http://" + providerAddress +
":50052/demo/hello?name=world")
+ .header("Content-type", "application/json")
+ .retrieve()
+ .toEntity(String.class);
+ // FIXME
+ Assert.assertEquals("\"Hello world\"", result.getBody());
+ }
+}
diff --git a/3-extensions/protocol/dubbo-samples-dubbo/pom.xml
b/2-advanced/dubbo-samples-triple-rest/pom.xml
similarity index 73%
rename from 3-extensions/protocol/dubbo-samples-dubbo/pom.xml
rename to 2-advanced/dubbo-samples-triple-rest/pom.xml
index c65dd459c..98c04a3ec 100644
--- a/3-extensions/protocol/dubbo-samples-dubbo/pom.xml
+++ b/2-advanced/dubbo-samples-triple-rest/pom.xml
@@ -22,36 +22,43 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>23</version>
+ <version>31</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.dubbo</groupId>
- <artifactId>dubbo-samples-dubbo</artifactId>
+ <artifactId>dubbo-samples-triple-rest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <name>Dubbo Samples Dubbo Protocol</name>
- <description>Dubbo Samples Dubbo Protocol</description>
+ <name>Dubbo Samples Triple Rest</name>
+ <description>Dubbo Samples Triple Rest</description>
<properties>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
+ <maven.compiler.source>17</maven.compiler.source>
+ <maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <dubbo.version>3.3.0-beta.1</dubbo.version>
- <spring-boot.version>2.7.8</spring-boot.version>
+ <dubbo.version>3.3.0-beta.2-SNAPSHOT</dubbo.version>
+ <spring-boot.version>3.2.3</spring-boot.version>
+ <spring.version>6.1.5</spring.version>
</properties>
<modules>
- <module>dubbo-samples-dubbo-interface</module>
- <module>dubbo-samples-dubbo-provider</module>
- <module>dubbo-samples-dubbo-consumer</module>
+ <module>dubbo-samples-triple-rest-springmvc</module>
+ <module>dubbo-samples-triple-rest-jaxrs</module>
</modules>
<dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-framework-bom</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
@@ -89,6 +96,17 @@
</dependencies>
<build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgs>
+ <compilerArg>-proc:none</compilerArg>
+ </compilerArgs>
+ </configuration>
+ </plugin>
+ </plugins>
<pluginManagement>
<plugins>
<plugin>
diff --git a/2-advanced/pom.xml b/2-advanced/pom.xml
index 80b20ae46..cdd0c993a 100644
--- a/2-advanced/pom.xml
+++ b/2-advanced/pom.xml
@@ -65,5 +65,7 @@
<module>dubbo-samples-annotation</module>
<module>dubbo-samples-spring-xml</module>
<module>dubbo-samples-api-with-registry</module>
+ <module>dubbo-samples-dubbo</module>
+ <module>dubbo-samples-triple-rest</module>
</modules>
</project>
diff --git a/3-extensions/protocol/pom.xml b/3-extensions/protocol/pom.xml
index fb6e4e37a..55a951fd0 100644
--- a/3-extensions/protocol/pom.xml
+++ b/3-extensions/protocol/pom.xml
@@ -27,7 +27,6 @@
<description>Dubbo Protocol Samples</description>
<modules>
- <module>dubbo-samples-dubbo</module>
<module>dubbo-samples-http</module>
<module>dubbo-samples-jetty</module>
<module>dubbo-samples-port-unification</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]