demo
Last updated
Was this helpful?
Last updated
Was this helpful?
demo
项目中开发一个对外服务接口及消费实例:
Dubbo采用全Spring配置方式,透明化接入应用,对应用没有任何API侵入,只需用Spring加载Dubbo的配置即可,Dubbo基于Spring的Schema扩展进行加载。
服务提供者
一、在DubboAPI中写入接口
二、服务提供方:实现此接口
三、服务提供方:用Spring配置声明暴露服务
服务消费者
四、服务消费方:通过Spring配置订阅该服务
五、服务消费方:使用IoC注入,并调用远程服务
项目Dubbo相关公共配置
web.xml配置
// 获取远程服务代理
// IDemoService demoService = (IDemoService)SpringConfigHelper.getBean("demoService");
//
// String hello = demoService.sayHello("world"); // 执行远程方法
// System.out.println(hello);
服务提供者
一、本地直联
二、多服务部署在一台机子上
pom.xml配置依赖的jar
Dubbo服务者消费者控制中心
服务消费者
Dubbo :