diff --git a/2-advanced/dubbo-samples-environment-keys/case-configuration.yml b/2-advanced/dubbo-samples-environment-keys/case-configuration.yml
index 3711aeee9b..cb355dc19e 100644
--- a/2-advanced/dubbo-samples-environment-keys/case-configuration.yml
+++ b/2-advanced/dubbo-samples-environment-keys/case-configuration.yml
@@ -14,11 +14,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from: app-builtin-zookeeper.yml
-
-props:
- project_name: dubbo-samples-environment-keys
- main_class: org.apache.dubbo.samples.basic.BasicProvider
- zookeeper_port: 2181
- dubbo_port: 20880
+services:
+ zookeeper:
+ image: zookeeper:latest
+ environment-keys-provider:
+ type: app
+ basedir: dubbo-samples-environment-keys-provider
+ mainClass: org.apache.dubbo.samples.environment.keys.provider.EnvironmentKeysProviderApplication
+ environment-keys-consumer:
+ type: test
+ basedir: dubbo-samples-environment-keys-consumer
+ tests:
+ - "**/*IT.class"
+ systemProps:
+ - zookeeper.address=environment-keys-provider
+ - zookeeper.port=2181
+ - dubbo.address=environment-keys-provider
+ - dubbo.port=20880
+ waitPortsBeforeRun:
+ - environment-keys-provider:2181
+ - environment-keys-provider:20880
+ depends_on:
+ - environment-keys-provider
diff --git a/2-advanced/dubbo-samples-environment-keys/case-versions.conf b/2-advanced/dubbo-samples-environment-keys/case-versions.conf
index 20c45c863f..816839de19 100644
--- a/2-advanced/dubbo-samples-environment-keys/case-versions.conf
+++ b/2-advanced/dubbo-samples-environment-keys/case-versions.conf
@@ -21,5 +21,5 @@
# Spring app
dubbo.version=2.7*, 3.*
-spring.version=4.*, 5.*
+spring-boot.version=2.*
java.version= [<= 11]
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/pom.xml b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/pom.xml
new file mode 100644
index 0000000000..98c325196a
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/pom.xml
@@ -0,0 +1,78 @@
+
+
+ 4.0.0
+
+ dubbo-samples-environment-keys
+ org.apache.dubbo
+ 1.0-SNAPSHOT
+ ../pom.xml
+
+
+ dubbo-samples-environment-keys-consumer
+
+
+
+ org.apache.dubbo
+ dubbo-samples-environment-keys-interface
+ ${project.parent.version}
+
+
+
+ org.apache.dubbo
+ dubbo-spring-boot-starter
+
+
+ org.apache.dubbo
+ dubbo-dependencies-zookeeper
+ pom
+
+
+ slf4j-reload4j
+ org.slf4j
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
+
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/java/org/apache/dubbo/samples/environment/keys/consumer/EnvironmentKeysConsumerApplication.java b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/java/org/apache/dubbo/samples/environment/keys/consumer/EnvironmentKeysConsumerApplication.java
new file mode 100644
index 0000000000..ed560c926a
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/java/org/apache/dubbo/samples/environment/keys/consumer/EnvironmentKeysConsumerApplication.java
@@ -0,0 +1,31 @@
+/*
+ * 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.samples.environment.keys.consumer;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableDubbo
+public class EnvironmentKeysConsumerApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(EnvironmentKeysConsumerApplication.class, args);
+ }
+
+}
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/java/org/apache/dubbo/samples/environment/keys/consumer/Task.java b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/java/org/apache/dubbo/samples/environment/keys/consumer/Task.java
new file mode 100644
index 0000000000..26568c1c03
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/java/org/apache/dubbo/samples/environment/keys/consumer/Task.java
@@ -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.
+ */
+package org.apache.dubbo.samples.environment.keys.consumer;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.dubbo.samples.environment.keys.api.DemoService;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Task implements CommandLineRunner {
+ @DubboReference
+ private DemoService demoService;
+ @Override
+ public void run(String... args) throws Exception {
+ String hello = demoService.sayHello("world");
+ System.out.println(hello);
+ }
+}
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/resources/application.yml b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/resources/application.yml
new file mode 100644
index 0000000000..575b238595
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/resources/application.yml
@@ -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.
+
+dubbo:
+ application:
+ name: demo-consumer
+ qos-enable: false
+# protocol:
+# name: dubbo
+# port: -1
+ registry:
+ address: zookeeper://${zookeeper.address:127.0.0.1}:2181
diff --git a/2-advanced/dubbo-samples-environment-keys/src/main/resources/log4j.properties b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/resources/log4j.properties
similarity index 100%
rename from 2-advanced/dubbo-samples-environment-keys/src/main/resources/log4j.properties
rename to 2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/main/resources/log4j.properties
diff --git a/2-advanced/dubbo-samples-environment-keys/src/test/java/org/apache/dubbo/samples/basic/DemoServiceIT.java b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/test/java/org/apache/dubbo/samples/environment/keys/consumer/DemoServiceIT.java
similarity index 57%
rename from 2-advanced/dubbo-samples-environment-keys/src/test/java/org/apache/dubbo/samples/basic/DemoServiceIT.java
rename to 2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/test/java/org/apache/dubbo/samples/environment/keys/consumer/DemoServiceIT.java
index 430eda6ae6..8e326c0eec 100644
--- a/2-advanced/dubbo-samples-environment-keys/src/test/java/org/apache/dubbo/samples/basic/DemoServiceIT.java
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-consumer/src/test/java/org/apache/dubbo/samples/environment/keys/consumer/DemoServiceIT.java
@@ -14,29 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.apache.dubbo.samples.environment.keys.consumer;
-package org.apache.dubbo.samples.basic;
-
-import org.apache.dubbo.samples.basic.api.DemoService;
-
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.spring.boot.autoconfigure.DubboAutoConfiguration;
+import org.dubbo.samples.environment.keys.api.DemoService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath*:spring/dubbo-demo-consumer.xml")
+@SpringBootTest(classes = {DubboAutoConfiguration.class})
+@RunWith(SpringRunner.class)
public class DemoServiceIT {
- @Autowired
- @Qualifier("demoService")
- private DemoService service;
-
+ @DubboReference
+ private DemoService demoService;
@Test
- public void testGreeting() throws Exception {
- Assert.assertTrue(service.sayHello("dubbo").startsWith("Hello dubbo"));
+ public void test() {
+ Assert.assertTrue(demoService.sayHello("dubbo").startsWith("Hello dubbo"));
}
+
}
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-interface/pom.xml b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-interface/pom.xml
new file mode 100644
index 0000000000..5b10d8d724
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-interface/pom.xml
@@ -0,0 +1,29 @@
+
+
+
+ dubbo-samples-environment-keys
+ org.apache.dubbo
+ 1.0-SNAPSHOT
+ ../pom.xml
+
+ 4.0.0
+
+ dubbo-samples-environment-keys-interface
+
\ No newline at end of file
diff --git a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/api/DemoService.java b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-interface/src/main/java/org/dubbo/samples/environment/keys/api/DemoService.java
similarity index 94%
rename from 2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/api/DemoService.java
rename to 2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-interface/src/main/java/org/dubbo/samples/environment/keys/api/DemoService.java
index f83ffafb08..7bfc1c94b5 100644
--- a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/api/DemoService.java
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-interface/src/main/java/org/dubbo/samples/environment/keys/api/DemoService.java
@@ -16,11 +16,8 @@
* limitations under the License.
*
*/
-
-package org.apache.dubbo.samples.basic.api;
+package org.dubbo.samples.environment.keys.api;
public interface DemoService {
-
String sayHello(String name);
-
}
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/pom.xml b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/pom.xml
new file mode 100644
index 0000000000..88e7066c19
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/pom.xml
@@ -0,0 +1,72 @@
+
+
+ 4.0.0
+
+ dubbo-samples-environment-keys
+ org.apache.dubbo
+ 1.0-SNAPSHOT
+ ../pom.xml
+
+ dubbo-samples-environment-keys-provider
+
+
+ org.apache.dubbo
+ dubbo-samples-environment-keys-interface
+ ${project.parent.version}
+
+
+
+ org.apache.dubbo
+ dubbo-spring-boot-starter
+
+
+ org.apache.dubbo
+ dubbo-dependencies-zookeeper
+ pom
+
+
+ slf4j-reload4j
+ org.slf4j
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
+
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/DemoServiceImpl.java b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/DemoServiceImpl.java
new file mode 100644
index 0000000000..4619508136
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/DemoServiceImpl.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.dubbo.samples.environment.keys.provider;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.rpc.RpcContext;
+import org.dubbo.samples.environment.keys.api.DemoService;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @Descrpition
+ * @Date 2023/3/7
+ */
+@DubboService
+public class DemoServiceImpl implements DemoService {
+ @Override
+ public String sayHello(String name) {
+ System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name +
+ ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
+ return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress();
+
+ }
+}
diff --git a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/EmbeddedZooKeeper.java b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/EmbeddedZooKeeper.java
similarity index 99%
rename from 2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/EmbeddedZooKeeper.java
rename to 2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/EmbeddedZooKeeper.java
index 969c9b8e27..38f709f1ba 100644
--- a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/EmbeddedZooKeeper.java
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/EmbeddedZooKeeper.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.dubbo.samples.basic;
+package org.apache.dubbo.samples.environment.keys.provider;
import org.apache.zookeeper.server.ServerConfig;
import org.apache.zookeeper.server.ZooKeeperServerMain;
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/EnvironmentKeysProviderApplication.java b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/EnvironmentKeysProviderApplication.java
new file mode 100644
index 0000000000..132352d3d8
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/java/org/apache/dubbo/samples/environment/keys/provider/EnvironmentKeysProviderApplication.java
@@ -0,0 +1,35 @@
+/*
+ * 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.samples.environment.keys.provider;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableDubbo
+public class EnvironmentKeysProviderApplication {
+
+
+ public static void main(String[] args) {
+ new EmbeddedZooKeeper(2181,false).start();
+ System.setProperty("dubbo.labels", "dubbo.key1=value1; dubbo.key2=value2");
+ System.setProperty("dubbo.env.keys", "DUBBO_KEY1, DUBBO_KEY2");
+ SpringApplication.run(EnvironmentKeysProviderApplication.class, args);
+ }
+
+}
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/resources/application.yml b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/resources/application.yml
new file mode 100644
index 0000000000..a68cb41e65
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/resources/application.yml
@@ -0,0 +1,26 @@
+# 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.
+dubbo:
+ application:
+ name: demo-provider
+ registry:
+ address: zookeeper://${zookeeper.address:127.0.0.1}:2181
+# protocol:
+# name: dubbo
+# port: 20880
+# host: 192.168.1.104
+ provider:
+ token: true
\ No newline at end of file
diff --git a/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/resources/log4j.properties b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..d6ecd5ce34
--- /dev/null
+++ b/2-advanced/dubbo-samples-environment-keys/dubbo-samples-environment-keys-provider/src/main/resources/log4j.properties
@@ -0,0 +1,26 @@
+#
+#
+# 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.
+#
+#
+
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/2-advanced/dubbo-samples-environment-keys/pom.xml b/2-advanced/dubbo-samples-environment-keys/pom.xml
index 91aff74e12..1eb3fadc81 100644
--- a/2-advanced/dubbo-samples-environment-keys/pom.xml
+++ b/2-advanced/dubbo-samples-environment-keys/pom.xml
@@ -18,29 +18,42 @@
- org.apache.dubbo
- 1.0-SNAPSHOT
-
+
+ org.apache
+ apache
+ 23
+
+
4.0.0
+ org.apache.dubbo
+ 1.0-SNAPSHOT
dubbo-samples-environment-keys
Dubbo Samples Environment Keys
Dubbo Samples Environment Keys
+ pom
1.8
1.8
- 3.1.6
+ 3.2.0-beta.6-SNAPSHOT
4.13.1
- 4.3.29.RELEASE
+ 2.7.8
+
+ dubbo-samples-environment-keys-interface
+ dubbo-samples-environment-keys-provider
+ dubbo-samples-environment-keys-consumer
+
+
+
- org.springframework
- spring-framework-bom
- ${spring.version}
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
pom
import
@@ -82,12 +95,6 @@
junit
test
-
-
- org.springframework
- spring-test
- test
-
@@ -118,9 +125,17 @@
${target.level}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
apache.snapshots.https
diff --git a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/BasicConsumer.java b/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/BasicConsumer.java
deleted file mode 100644
index 4532160924..0000000000
--- a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/BasicConsumer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * 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.samples.basic;
-
-import org.apache.dubbo.samples.basic.api.DemoService;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class BasicConsumer {
-
- public static void main(String[] args) {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo-consumer.xml");
- context.start();
- DemoService demoService = (DemoService) context.getBean("demoService");
- String hello = demoService.sayHello("world");
- System.out.println(hello);
- }
-}
diff --git a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/BasicProvider.java b/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/BasicProvider.java
deleted file mode 100644
index 7e64a53241..0000000000
--- a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/BasicProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * 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.samples.basic;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class BasicProvider {
-
- public static void main(String[] args) throws Exception {
- new EmbeddedZooKeeper(2181, false).start();
- // wait for embedded zookeeper start completely.
- Thread.sleep(1000);
-
- System.setProperty("dubbo.labels", "dubbo.key1=value1; dubbo.key2=value2");
- System.setProperty("dubbo.env.keys", "DUBBO_KEY1, DUBBO_KEY2");
-
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-demo-provider.xml");
- context.start();
-
- System.out.println("dubbo service started");
- System.in.read();
- }
-
-}
diff --git a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/impl/DemoServiceImpl.java b/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/impl/DemoServiceImpl.java
deleted file mode 100644
index 242fcc31dd..0000000000
--- a/2-advanced/dubbo-samples-environment-keys/src/main/java/org/apache/dubbo/samples/basic/impl/DemoServiceImpl.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * 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.samples.basic.impl;
-
-import org.apache.dubbo.rpc.RpcContext;
-import org.apache.dubbo.samples.basic.api.DemoService;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-public class DemoServiceImpl implements DemoService {
-
- @Override
- public String sayHello(String name) {
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name +
- ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
- return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress();
- }
-
-}
diff --git a/2-advanced/dubbo-samples-environment-keys/src/main/resources/spring/dubbo-demo-consumer.xml b/2-advanced/dubbo-samples-environment-keys/src/main/resources/spring/dubbo-demo-consumer.xml
deleted file mode 100644
index 651b7f7840..0000000000
--- a/2-advanced/dubbo-samples-environment-keys/src/main/resources/spring/dubbo-demo-consumer.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/2-advanced/dubbo-samples-environment-keys/src/main/resources/spring/dubbo-demo-provider.xml b/2-advanced/dubbo-samples-environment-keys/src/main/resources/spring/dubbo-demo-provider.xml
deleted file mode 100644
index 438f69ac1e..0000000000
--- a/2-advanced/dubbo-samples-environment-keys/src/main/resources/spring/dubbo-demo-provider.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-