dubbo源码中提供一个demo
其中包含3个项目:
api provider consumer
api中定义了一个接口 供其他两个引用
public interface DemoService {
String sayHello(String name);
}
在provider中提供了上面接口的一个实现
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();
}
}
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext contex