diff --git a/2-advanced/dubbo-samples-direct/case-configuration.yml b/2-advanced/dubbo-samples-direct/case-configuration.yml
index 8f5751582a..cbd378da4c 100644
--- a/2-advanced/dubbo-samples-direct/case-configuration.yml
+++ b/2-advanced/dubbo-samples-direct/case-configuration.yml
@@ -14,9 +14,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from: app-external-zookeeper.yml
+services:
+
+ direct-provider:
+ type: app
+ basedir: dubbo-samples-direct-provider
+ mainClass: org.apache.dubbo.samples.direct.DirectProviderApplication
+# systemProps:
+# - zookeeper.address=zookeeper
+# waitPortsBeforeRun:
+# - zookeeper:2181
+# checkPorts:
+# - 20880
+# checkLog: "Current Spring Boot Application is await..."
+ direct-consumer:
+ type: test
+ basedir: dubbo-samples-direct-consumer
+ tests:
+ - "**/*IT.class"
+ systemProps:
+ - zookeeper.address=direct-provider
+ - zookeeper.port=2181
+ - dubbo.address=direct-provider
+ - dubbo.port=20880
+ waitPortsBeforeRun:
+ - direct-provider:2181
+ - direct-provider:20880
+ depends_on:
+ - direct-provider
-props:
- project_name: dubbo-samples-direct
- main_class: org.apache.dubbo.samples.direct.DirectProvider
- dubbo_port: 20880
\ No newline at end of file
diff --git a/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/pom.xml b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/pom.xml
new file mode 100644
index 0000000000..ad32575d2b
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/pom.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+ dubbo-samples-direct
+ org.apache.dubbo
+ 1.0-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ dubbo-samples-direct-consumer
+
+
+
+ org.apache.dubbo
+ dubbo-samples-direct-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-direct/dubbo-samples-direct-consumer/src/main/java/org/apache/dubbo/samples/direct/DirectConsumerApplication.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/java/org/apache/dubbo/samples/direct/DirectConsumerApplication.java
new file mode 100644
index 0000000000..6d17428545
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/java/org/apache/dubbo/samples/direct/DirectConsumerApplication.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.direct;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableDubbo
+public class DirectConsumerApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(DirectConsumerApplication.class,args);
+ }
+}
diff --git a/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/java/org/apache/dubbo/samples/direct/Task.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/java/org/apache/dubbo/samples/direct/Task.java
new file mode 100644
index 0000000000..b909465337
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/java/org/apache/dubbo/samples/direct/Task.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.samples.direct;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.dubbo.samples.direct.api.DirectService;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+
+
+@Component
+public class Task implements CommandLineRunner {
+ @DubboReference(interfaceClass = DirectService.class,
+ check = false,
+ group = "test",
+ version = "1.0.0-daily")
+ private DirectService directService;
+
+ @Override
+ public void run(String... args) throws Exception {
+ String hello = directService.sayHello("world");
+ System.out.println(hello);
+
+ }
+}
diff --git a/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/resources/application.yml b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/resources/application.yml
new file mode 100644
index 0000000000..933e5be5e8
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/resources/application.yml
@@ -0,0 +1,24 @@
+# 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: direct-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-direct/src/main/resources/log4j.properties b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/resources/log4j.properties
similarity index 100%
rename from 2-advanced/dubbo-samples-direct/src/main/resources/log4j.properties
rename to 2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/main/resources/log4j.properties
diff --git a/2-advanced/dubbo-samples-direct/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java
similarity index 84%
rename from 2-advanced/dubbo-samples-direct/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java
rename to 2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java
index 539bdd0bfd..0f93040042 100644
--- a/2-advanced/dubbo-samples-direct/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-consumer/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java
@@ -17,40 +17,47 @@
package org.apache.dubbo.samples.direct;
+import junit.framework.TestCase;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.rpc.service.GenericService;
import org.apache.dubbo.samples.direct.api.DirectService;
-
-import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-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-direct-consumer.xml"})
+@SpringBootTest
+@RunWith(SpringRunner.class)
public class DirectServiceIT {
private static String providerAddress = System.getProperty("dubbo.address", "localhost");
- @Autowired
+ @DubboReference(interfaceClass = DirectService.class,
+ check = false,
+ group = "test",
+ version = "1.0.0-daily")
private DirectService directService;
+
+
@Test
public void testXml() throws Exception {
+
Assert.assertTrue(directService.sayHello("dubbo").startsWith("Hello dubbo"));
}
@Test
public void testGeneric() throws Exception {
+
ApplicationConfig application = new ApplicationConfig();
application.setName("direct-consumer");
+ System.out.println(application.getClass());
ReferenceConfig reference = new ReferenceConfig<>();
reference.setUrl("dubbo://" + providerAddress + ":20880/" + DirectService.class.getName());
- reference.setVersion("1.0.0-daily");
- reference.setGroup("test2");
+ reference.setVersion("1.0.0-daily");
+ reference.setGroup("test2");
reference.setGeneric(true);
reference.setApplication(application);
reference.setInterface(DirectService.class.getName());
diff --git a/2-advanced/dubbo-samples-direct/dubbo-samples-direct-interface/pom.xml b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-interface/pom.xml
new file mode 100644
index 0000000000..0c0a184929
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-interface/pom.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ dubbo-samples-direct
+ org.apache.dubbo
+ 1.0-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ dubbo-samples-direct-interface
+
+
\ No newline at end of file
diff --git a/2-advanced/dubbo-samples-direct/dubbo-samples-direct-interface/src/main/java/org/apache/dubbo/samples/direct/api/DirectService.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-interface/src/main/java/org/apache/dubbo/samples/direct/api/DirectService.java
new file mode 100644
index 0000000000..9ac20e7b72
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-interface/src/main/java/org/apache/dubbo/samples/direct/api/DirectService.java
@@ -0,0 +1,22 @@
+/*
+ * 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.direct.api;
+
+public interface DirectService {
+ String sayHello(String name);
+}
diff --git a/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/pom.xml b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/pom.xml
new file mode 100644
index 0000000000..d1f3f96984
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/pom.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+ dubbo-samples-direct
+ org.apache.dubbo
+ 1.0-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ dubbo-samples-direct-provider
+
+
+
+ org.apache.dubbo
+ dubbo-samples-direct-interface
+ ${project.parent.version}
+
+
+
+
+ org.apache.dubbo
+ dubbo-spring-boot-starter
+
+
+ org.apache.dubbo
+ dubbo-dependencies-zookeeper-curator5
+ 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-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/DirectProviderApplication.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/DirectProviderApplication.java
new file mode 100644
index 0000000000..02f56f6d0a
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/DirectProviderApplication.java
@@ -0,0 +1,32 @@
+/*
+ * 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.direct;
+
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+@EnableDubbo
+public class DirectProviderApplication {
+
+ public static void main(String[] args) {
+ new EmbeddedZooKeeper(2181,false).start();
+ SpringApplication.run(DirectProviderApplication.class, args);
+ }
+}
diff --git a/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/EmbeddedZooKeeper.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/EmbeddedZooKeeper.java
new file mode 100644
index 0000000000..e050bb6757
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/EmbeddedZooKeeper.java
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2014 the original author or authors.
+ *
+ * Licensed 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.direct;
+
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.SmartLifecycle;
+import org.springframework.util.ErrorHandler;
+import org.springframework.util.SocketUtils;
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.Properties;
+import java.util.UUID;
+/**
+ * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
+ *
+ * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
+ *
+ * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
+ * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
+ *
+ * @author Patrick Peralta
+ * @author Mark Fisher
+ * @author David Turanski
+ */
+public class EmbeddedZooKeeper implements SmartLifecycle {
+ /**
+ * Logger.
+ */
+ private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
+ /**
+ * ZooKeeper client port. This will be determined dynamically upon startup.
+ */
+ private final int clientPort;
+ /**
+ * Whether to auto-start. Default is true.
+ */
+ private boolean autoStartup = true;
+ /**
+ * Lifecycle phase. Default is 0.
+ */
+ private int phase = 0;
+ /**
+ * Thread for running the ZooKeeper server.
+ */
+ private volatile Thread zkServerThread;
+ /**
+ * ZooKeeper server.
+ */
+ private volatile ZooKeeperServerMain zkServer;
+ /**
+ * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
+ */
+ private ErrorHandler errorHandler;
+ private boolean daemon = true;
+ /**
+ * Construct an EmbeddedZooKeeper with a random port.
+ */
+ public EmbeddedZooKeeper() {
+ clientPort = SocketUtils.findAvailableTcpPort();
+ }
+ /**
+ * Construct an EmbeddedZooKeeper with the provided port.
+ *
+ * @param clientPort port for ZooKeeper server to bind to
+ */
+ public EmbeddedZooKeeper(int clientPort, boolean daemon) {
+ this.clientPort = clientPort;
+ this.daemon = daemon;
+ }
+ /**
+ * Returns the port that clients should use to connect to this embedded server.
+ *
+ * @return dynamically determined client port
+ */
+ public int getClientPort() {
+ return this.clientPort;
+ }
+ /**
+ * Specify whether to start automatically. Default is true.
+ *
+ * @param autoStartup whether to start automatically
+ */
+ public void setAutoStartup(boolean autoStartup) {
+ this.autoStartup = autoStartup;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isAutoStartup() {
+ return this.autoStartup;
+ }
+ /**
+ * Specify the lifecycle phase for the embedded server.
+ *
+ * @param phase the lifecycle phase
+ */
+ public void setPhase(int phase) {
+ this.phase = phase;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getPhase() {
+ return this.phase;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isRunning() {
+ return (zkServerThread != null);
+ }
+ /**
+ * Start the ZooKeeper server in a background thread.
+ *
+ * Register an error handler via {@link #setErrorHandler} in order to handle
+ * any exceptions thrown during startup or execution.
+ */
+ @Override
+ public synchronized void start() {
+ if (zkServerThread == null) {
+ zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
+ zkServerThread.setDaemon(daemon);
+ zkServerThread.start();
+ }
+ }
+ /**
+ * Shutdown the ZooKeeper server.
+ */
+ @Override
+ public synchronized void stop() {
+ if (zkServerThread != null) {
+ // The shutdown method is protected...thus this hack to invoke it.
+ // This will log an exception on shutdown; see
+ // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
+ try {
+ Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
+ shutdown.setAccessible(true);
+ shutdown.invoke(zkServer);
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ // It is expected that the thread will exit after
+ // the server is shutdown; this will block until
+ // the shutdown is complete.
+ try {
+ zkServerThread.join(5000);
+ zkServerThread = null;
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
+ // abandoning zk thread
+ zkServerThread = null;
+ }
+ }
+ }
+ /**
+ * Stop the server if running and invoke the callback when complete.
+ */
+ @Override
+ public void stop(Runnable callback) {
+ stop();
+ callback.run();
+ }
+ /**
+ * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
+ * is provided, only error-level logging will occur.
+ *
+ * @param errorHandler the {@link ErrorHandler} to be invoked
+ */
+ public void setErrorHandler(ErrorHandler errorHandler) {
+ this.errorHandler = errorHandler;
+ }
+ /**
+ * Runnable implementation that starts the ZooKeeper server.
+ */
+ private class ServerRunnable implements Runnable {
+ @Override
+ public void run() {
+ try {
+ Properties properties = new Properties();
+ File file = new File(System.getProperty("java.io.tmpdir")
+ + File.separator + UUID.randomUUID());
+ file.deleteOnExit();
+ properties.setProperty("dataDir", file.getAbsolutePath());
+ properties.setProperty("clientPort", String.valueOf(clientPort));
+ QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
+ quorumPeerConfig.parseProperties(properties);
+ zkServer = new ZooKeeperServerMain();
+ ServerConfig configuration = new ServerConfig();
+ configuration.readFrom(quorumPeerConfig);
+ zkServer.runFromConfig(configuration);
+ }
+ catch (Exception e) {
+ if (errorHandler != null) {
+ errorHandler.handleError(e);
+ }
+ else {
+ logger.error("Exception running embedded ZooKeeper", e);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl.java
new file mode 100644
index 0000000000..eee4d8a028
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl.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.direct.impl;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.samples.direct.api.DirectService;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@DubboService(interfaceClass = DirectService.class,group = "test",version = "1.0.0-daily")
+public class DirectServiceImpl implements DirectService {
+ @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-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl2.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl2.java
new file mode 100644
index 0000000000..959f25af84
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl2.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.direct.impl;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.samples.direct.api.DirectService;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@DubboService(interfaceClass = DirectService.class,group = "test2",version = "1.0.0-daily")
+public class DirectServiceImpl2 implements DirectService {
+ @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-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl3.java b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl3.java
new file mode 100644
index 0000000000..e5e26166b2
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl3.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.direct.impl;
+
+import org.apache.dubbo.config.annotation.DubboService;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.samples.direct.api.DirectService;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@DubboService(interfaceClass = DirectService.class,group = "test3",version = "1.0.0-daily")
+public class DirectServiceImpl3 implements DirectService {
+ @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-direct/dubbo-samples-direct-provider/src/main/resources/application.yml b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/resources/application.yml
new file mode 100644
index 0000000000..727c1eaebe
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/resources/application.yml
@@ -0,0 +1,24 @@
+# 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: direct-provider
+ 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-direct/dubbo-samples-direct-provider/src/main/resources/log4j.properties b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-provider/src/main/resources/log4j.properties
new file mode 100644
index 0000000000..d6ecd5ce34
--- /dev/null
+++ b/2-advanced/dubbo-samples-direct/dubbo-samples-direct-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-direct/pom.xml b/2-advanced/dubbo-samples-direct/pom.xml
index 393df29565..d0c52845b0 100644
--- a/2-advanced/dubbo-samples-direct/pom.xml
+++ b/2-advanced/dubbo-samples-direct/pom.xml
@@ -18,30 +18,44 @@
- org.apache.dubbo
- 1.0-SNAPSHOT
+
+
+ org.apache
+ apache
+ 23
+
+ 4.0.0
+ org.apache.dubbodubbo-samples-direct
+ 1.0-SNAPSHOT
+ pomDubbo Samples DirectDubbo Samples Direct
- 1.8
- 1.8
- 3.1.6
- 4.3.29.RELEASE
+ 3.2.0-beta.6-SNAPSHOT4.13.1
- 3.7.0
+ 2.7.8
+ 1.8
+ 1.8
+
+ dubbo-samples-direct-consumer
+ dubbo-samples-direct-interface
+ dubbo-samples-direct-provider
+
+
+
- org.springframework
- spring-framework-bom
- ${spring.version}
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}pomimport
@@ -54,10 +68,16 @@
org.apache.dubbo
- dubbo-dependencies-zookeeper
+ dubbo-dependencies-zookeeper-curator5${dubbo.version}pom
+
+ junit
+ junit
+ ${junit.version}
+ test
+
@@ -67,11 +87,6 @@
dubbo
-
- org.apache.dubbo
- dubbo-dependencies-zookeeper
- pom
- junit
@@ -80,41 +95,19 @@
test
-
- org.springframework
- spring-test
- test
-
-
-
-
- javax.annotation
-
- [1.11,)
-
-
-
- javax.annotation
- javax.annotation-api
- 1.3.2
-
-
-
-
+
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
- ${source.level}
- ${target.level}
-
-
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+
+
diff --git a/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/DirectConsumer.java b/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/DirectConsumer.java
deleted file mode 100644
index 5d62854b42..0000000000
--- a/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/DirectConsumer.java
+++ /dev/null
@@ -1,36 +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.direct;
-
-import org.apache.dubbo.samples.direct.api.DirectService;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-
-public class DirectConsumer {
-
- public static void main(String[] args) {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-direct-consumer.xml");
- context.start();
- DirectService directService = (DirectService) context.getBean("directService");
- String hello = directService.sayHello("world");
- System.out.println(hello);
- }
-}
diff --git a/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/DirectProvider.java b/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/DirectProvider.java
deleted file mode 100644
index 5a22e50678..0000000000
--- a/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/DirectProvider.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.direct;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.util.concurrent.CountDownLatch;
-
-
-public class DirectProvider {
-
- public static void main(String[] args) throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-direct-provider.xml");
- context.start();
- System.out.println("dubbo service started");
- new CountDownLatch(1).await();
- }
-}
diff --git a/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/api/DirectService.java b/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/api/DirectService.java
deleted file mode 100644
index a65e47990f..0000000000
--- a/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/api/DirectService.java
+++ /dev/null
@@ -1,27 +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.direct.api;
-
-
-public interface DirectService {
-
- String sayHello(String name);
-
-}
diff --git a/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl.java b/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl.java
deleted file mode 100644
index 2a4e0c6904..0000000000
--- a/2-advanced/dubbo-samples-direct/src/main/java/org/apache/dubbo/samples/direct/impl/DirectServiceImpl.java
+++ /dev/null
@@ -1,36 +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.direct.impl;
-
-import org.apache.dubbo.rpc.RpcContext;
-import org.apache.dubbo.samples.direct.api.DirectService;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-
-public class DirectServiceImpl implements DirectService {
-
- 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-direct/src/main/resources/spring/dubbo-direct-consumer.xml b/2-advanced/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-consumer.xml
deleted file mode 100644
index 82a6b93be2..0000000000
--- a/2-advanced/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-consumer.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/2-advanced/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-provider.xml b/2-advanced/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-provider.xml
deleted file mode 100644
index 3f9ab40408..0000000000
--- a/2-advanced/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-provider.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-