diff --git a/whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/itlong/whatsmars/dubbo/demo/api/DemoService.java b/whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/DemoService.java
similarity index 70%
rename from whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/itlong/whatsmars/dubbo/demo/api/DemoService.java
rename to whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/DemoService.java
index c8fec7402a01b1405515edbe8577aa6af9d7b6fc..6a273261a7e2253358a3e70d311b12999eb812ca 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/itlong/whatsmars/dubbo/demo/api/DemoService.java
+++ b/whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/DemoService.java
@@ -1,7 +1,7 @@
/**
* Created by shenhongxi on 2017/6/21.
*/
-package com.itlong.whatsmars.dubbo.demo.api;
+package com.whatsmars.dubbo.demo.api;
public interface DemoService {
diff --git a/whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/itlong/whatsmars/dubbo/demo/api/UserService.java b/whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/UserService.java
similarity index 70%
rename from whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/itlong/whatsmars/dubbo/demo/api/UserService.java
rename to whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/UserService.java
index 484362c9142870b9ef00bd12012f15d2204eb7bb..5a798a5ed8cdf8566d527639452f4b0f6dfc27fd 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/itlong/whatsmars/dubbo/demo/api/UserService.java
+++ b/whatsmars-dubbo/whatsmars-dubbo-api/src/main/java/com/whatsmars/dubbo/demo/api/UserService.java
@@ -1,7 +1,7 @@
/**
* Created by shenhongxi on 2017/6/21.
*/
-package com.itlong.whatsmars.dubbo.demo.api;
+package com.whatsmars.dubbo.demo.api;
public interface UserService {
diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer-boot/src/main/java/com/whatsmars/dubbo/demo/consumer/rpc/DemoRpc.java b/whatsmars-dubbo/whatsmars-dubbo-consumer-boot/src/main/java/com/whatsmars/dubbo/demo/consumer/rpc/DemoRpc.java
index 0f71b3ea8f5341c6e4885355fccb9840b794880c..5c2c2a6a4b388d86b00719f3d9b0f9b064f2aa3f 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-consumer-boot/src/main/java/com/whatsmars/dubbo/demo/consumer/rpc/DemoRpc.java
+++ b/whatsmars-dubbo/whatsmars-dubbo-consumer-boot/src/main/java/com/whatsmars/dubbo/demo/consumer/rpc/DemoRpc.java
@@ -1,7 +1,7 @@
package com.whatsmars.dubbo.demo.consumer.rpc;
import com.alibaba.dubbo.config.annotation.Reference;
-import com.itlong.whatsmars.dubbo.demo.api.DemoService;
+import com.whatsmars.dubbo.demo.api.DemoService;
import org.springframework.stereotype.Component;
/**
diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/itlong/whatsmars/dubbo/demo/consumer/DemoAction.java b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoAction.java
similarity index 60%
rename from whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/itlong/whatsmars/dubbo/demo/consumer/DemoAction.java
rename to whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoAction.java
index f1349a7ffd4da1c555d69585a7dc93bf32e0ca24..dc44abeea01b675dc6b32b472a0413c06383163c 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/itlong/whatsmars/dubbo/demo/consumer/DemoAction.java
+++ b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoAction.java
@@ -1,10 +1,9 @@
/**
* Created by shenhongxi on 2017/6/21.
*/
-package com.itlong.whatsmars.dubbo.demo.consumer;
+package com.whatsmars.dubbo.demo.consumer;
-import com.itlong.whatsmars.dubbo.demo.api.DemoService;
-import com.itlong.whatsmars.dubbo.demo.api.UserService;
+import com.whatsmars.dubbo.demo.api.DemoService;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -13,23 +12,15 @@ public class DemoAction {
private DemoService demoService;
- private UserService userService;
-
public void setDemoService(DemoService demoService) {
this.demoService = demoService;
}
- public void setUserService(UserService userService) {
- this.userService = userService;
- }
-
public void start() throws Exception {
for (int i = 0; i < Integer.MAX_VALUE; i ++) {
try {
String hello = demoService.sayHello("world" + i);
- String hi = userService.sayHi("java" + i);
System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " + hello);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " + hi);
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/itlong/whatsmars/dubbo/demo/consumer/DemoConsumer.java b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoConsumer.java
similarity index 77%
rename from whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/itlong/whatsmars/dubbo/demo/consumer/DemoConsumer.java
rename to whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoConsumer.java
index 8a5e8939c4211be2edb0630cbcbc3c1a871d2ce3..4f57153cc18cdea71263c3e1b52f8f47ebf123df 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/itlong/whatsmars/dubbo/demo/consumer/DemoConsumer.java
+++ b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/com/whatsmars/dubbo/demo/consumer/DemoConsumer.java
@@ -1,7 +1,7 @@
/**
* Created by shenhongxi on 2017/6/21.
*/
-package com.itlong.whatsmars.dubbo.demo.consumer;
+package com.whatsmars.dubbo.demo.consumer;
public class DemoConsumer {
diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-action.xml b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-action.xml
index f561fddced921146899dd5ee9c2036ad541a4da7..a1a193a935551f46b38c92a5226cc753079f35cf 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-action.xml
+++ b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-action.xml
@@ -1,28 +1,12 @@
-
+
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
-
+
-
\ No newline at end of file
diff --git a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-consumer.xml b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-consumer.xml
index f5a165d0d9dbf9ea654432a2fb061546089cb882..6605e01efd30f95876a9ab7ad1036600476715b0 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-consumer.xml
+++ b/whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/spring/dubbo-demo-consumer.xml
@@ -1,23 +1,9 @@
-
+
@@ -25,7 +11,6 @@
-
-
+
\ No newline at end of file
diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider-boot/src/main/java/com/whatsmars/dubbo/demo/provider/resource/DemoServiceImpl.java b/whatsmars-dubbo/whatsmars-dubbo-provider-boot/src/main/java/com/whatsmars/dubbo/demo/provider/resource/DemoServiceImpl.java
index 98f4392eaf8b68e2e17a42cfc6728e931f6bdeb8..95095017909c3d8c07fd52d460f74bcb78343382 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-provider-boot/src/main/java/com/whatsmars/dubbo/demo/provider/resource/DemoServiceImpl.java
+++ b/whatsmars-dubbo/whatsmars-dubbo-provider-boot/src/main/java/com/whatsmars/dubbo/demo/provider/resource/DemoServiceImpl.java
@@ -5,7 +5,7 @@ package com.whatsmars.dubbo.demo.provider.resource;
import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.dubbo.rpc.RpcContext;
-import com.itlong.whatsmars.dubbo.demo.api.DemoService;
+import com.whatsmars.dubbo.demo.api.DemoService;
import com.whatsmars.dubbo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml b/whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml
index 6ba7d17b8cedf92dee4bc510600a9a25cbc4fcdb..6968fa4fecf9f2a3aedde2f1cbd19c43c4ae1b75 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml
+++ b/whatsmars-dubbo/whatsmars-dubbo-provider/pom.xml
@@ -43,6 +43,11 @@
zkclient
0.9
+
+ com.itlong
+ whatsmars-dubbo-service
+ 1.0-SNAPSHOT
+
diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/DemoServiceImpl.java b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/DemoServiceImpl.java
deleted file mode 100644
index 12045866663e73bce508cdc53438adab05bd8292..0000000000000000000000000000000000000000
--- a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/DemoServiceImpl.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Created by shenhongxi on 2017/6/21.
- */
-package com.itlong.whatsmars.dubbo.demo.provider;
-
-import com.alibaba.dubbo.rpc.RpcContext;
-import com.itlong.whatsmars.dubbo.demo.api.DemoService;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-public class DemoServiceImpl implements DemoService {
-
- 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 form provider: " + RpcContext.getContext().getLocalAddress();
- }
-
-}
\ No newline at end of file
diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/UserServiceImpl.java b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/UserServiceImpl.java
deleted file mode 100644
index 4830773d2b9f59d451573a1a19f598ef38e6553c..0000000000000000000000000000000000000000
--- a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/UserServiceImpl.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Created by shenhongxi on 2017/6/21.
- */
-package com.itlong.whatsmars.dubbo.demo.provider;
-
-import com.alibaba.dubbo.rpc.RpcContext;
-import com.itlong.whatsmars.dubbo.demo.api.UserService;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-public class UserServiceImpl implements UserService {
-
- public String sayHi(String name) {
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hi " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
- return "Hi " + name + ", response form provider: " + RpcContext.getContext().getLocalAddress();
- }
-
-}
\ No newline at end of file
diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/DemoProvider.java b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoProvider.java
similarity index 81%
rename from whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/DemoProvider.java
rename to whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoProvider.java
index cb06f2282903ed19b1aacdb0620e7447373647f8..4bf7681fbf1e104e3acf998710b95dec57af1245 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/itlong/whatsmars/dubbo/demo/provider/DemoProvider.java
+++ b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoProvider.java
@@ -1,7 +1,7 @@
/**
* Created by shenhongxi on 2017/6/21.
*/
-package com.itlong.whatsmars.dubbo.demo.provider;
+package com.whatsmars.dubbo.demo.provider;
import java.io.IOException;
diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoServiceImpl.java b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..0d60fcfc20e17dcc9dc06e3408531dbb724944b2
--- /dev/null
+++ b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/com/whatsmars/dubbo/demo/provider/DemoServiceImpl.java
@@ -0,0 +1,27 @@
+/**
+ * Created by shenhongxi on 2017/6/21.
+ */
+package com.whatsmars.dubbo.demo.provider;
+
+import com.alibaba.dubbo.rpc.RpcContext;
+import com.whatsmars.dubbo.demo.api.DemoService;
+import com.whatsmars.dubbo.service.UserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Service("demoService")
+public class DemoServiceImpl implements DemoService {
+
+ @Autowired
+ private UserService userService;
+
+ public String sayHello(String name) {
+ boolean registerSuccess = userService.register(name);
+ System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
+ return "Hello " + name + ", registerSuccess:" + registerSuccess + ", response form provider: " + RpcContext.getContext().getLocalAddress();
+ }
+
+}
\ No newline at end of file
diff --git a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/spring/dubbo-demo-provider.xml b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/spring/dubbo-demo-provider.xml
index 480bdd99f15da135cc2fd506b14efaf6e5f9fe16..16b182ca4324e4d49c72c6da8d4bb3d5c9051815 100644
--- a/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/spring/dubbo-demo-provider.xml
+++ b/whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/spring/dubbo-demo-provider.xml
@@ -1,24 +1,13 @@
-
+
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+ http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
+ default-autowire="byName">
@@ -26,11 +15,9 @@
-
-
-
-
-
+
+
+
\ No newline at end of file