Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
武汉红喜
whatsmars
提交
dc1c9b90
W
whatsmars
项目概览
武汉红喜
/
whatsmars
通知
3
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
whatsmars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
dc1c9b90
编写于
1月 06, 2018
作者:
武汉红喜
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
服务分组
上级
64dd2443
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
6 deletion
+34
-6
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/org/hongxi/whatsmars/dubbo/demo/consumer/DemoConsumer.java
...rg/hongxi/whatsmars/dubbo/demo/consumer/DemoConsumer.java
+14
-6
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/META-INF/spring/dubbo-demo-consumer.xml
...rc/main/resources/META-INF/spring/dubbo-demo-consumer.xml
+2
-0
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/org/hongxi/whatsmars/dubbo/demo/provider/DemoServiceImpl2.java
...ongxi/whatsmars/dubbo/demo/provider/DemoServiceImpl2.java
+16
-0
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
...rc/main/resources/META-INF/spring/dubbo-demo-provider.xml
+2
-0
未找到文件。
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/java/org/hongxi/whatsmars/dubbo/demo/consumer/DemoConsumer.java
浏览文件 @
dc1c9b90
...
...
@@ -13,17 +13,25 @@ public class DemoConsumer {
ClassPathXmlApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
new
String
[]{
"META-INF/spring/dubbo-demo-consumer.xml"
});
context
.
start
();
// dubbo protocol
DemoService
demoService
=
(
DemoService
)
context
.
getBean
(
"demoService"
);
// 获取远程服务代理
String
hello
=
demoService
.
sayHello
(
"dubbo"
);
// 执行远程方法
System
.
out
.
println
(
hello
);
// 显示调用结果
DemoService
demoService2
=
(
DemoService
)
context
.
getBean
(
"demoService2"
);
// 获取远程服务代理
String
hello2
=
demoService2
.
sayHello
(
"hessian直连"
);
// 执行远程方法
System
.
out
.
println
(
hello2
);
// 显示调用结果
// hessian protocol 直连
DemoService
demoService2
=
(
DemoService
)
context
.
getBean
(
"demoService2"
);
String
hello2
=
demoService2
.
sayHello
(
"hessian直连"
);
System
.
out
.
println
(
hello2
);
DemoService
demoService3
=
(
DemoService
)
context
.
getBean
(
"demoService3"
);
// 获取远程服务代理
String
hello3
=
demoService3
.
sayHello
(
"hessian"
);
// 执行远程方法
System
.
out
.
println
(
hello3
);
// 显示调用结果
// hessian protocol
DemoService
demoService3
=
(
DemoService
)
context
.
getBean
(
"demoService3"
);
String
hello3
=
demoService3
.
sayHello
(
"hessian"
);
System
.
out
.
println
(
hello3
);
// service group
DemoService
demoService4
=
(
DemoService
)
context
.
getBean
(
"demoService4"
);
String
hello4
=
demoService4
.
sayHello
(
"group:new"
);
System
.
out
.
println
(
hello4
);
}
...
...
whatsmars-dubbo/whatsmars-dubbo-consumer/src/main/resources/META-INF/spring/dubbo-demo-consumer.xml
浏览文件 @
dc1c9b90
...
...
@@ -20,4 +20,6 @@
<dubbo:reference
id=
"demoService3"
interface=
"org.hongxi.whatsmars.dubbo.demo.api.DemoService"
protocol=
"hessian"
/>
<dubbo:reference
id=
"demoService4"
group=
"new"
interface=
"org.hongxi.whatsmars.dubbo.demo.api.DemoService"
/>
</beans>
\ No newline at end of file
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/java/org/hongxi/whatsmars/dubbo/demo/provider/DemoServiceImpl2.java
0 → 100644
浏览文件 @
dc1c9b90
/**
* Created by shenhongxi on 2017/6/21.
*/
package
org.hongxi.whatsmars.dubbo.demo.provider
;
import
org.hongxi.whatsmars.dubbo.demo.api.DemoService
;
import
org.springframework.stereotype.Service
;
@Service
(
"demoService2"
)
public
class
DemoServiceImpl2
implements
DemoService
{
public
String
sayHello
(
String
name
)
{
return
"Hello "
+
name
;
}
}
\ No newline at end of file
whatsmars-dubbo/whatsmars-dubbo-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
浏览文件 @
dc1c9b90
...
...
@@ -26,5 +26,7 @@
<dubbo:service
interface=
"org.hongxi.whatsmars.dubbo.demo.api.DemoService"
ref=
"demoService"
timeout=
"500"
/>
<!-- 默认配了 protocol="dubbo,hessian" -->
<!-- 类似group的还有version="2.0.0" -->
<dubbo:service
group=
"new"
interface=
"org.hongxi.whatsmars.dubbo.demo.api.DemoService"
ref=
"demoService2"
/>
</beans>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录