Implement interface in service provider
在服务提供者里实现接口:
DemoServiceImpl.java 2:
package org.apache.dubbo.demo.provider;
import org.apache.dubbo.demo.DemoService;
public class DemoServiceImpl implements DemoService {
public String sayHello(String name) {
return "Hello " + name;
}
}
Exposing service with Spring configuration
使用spring配置暴漏服务
provider.xml:
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
The demo uses multicast as the registry since it is simple and does not require to extra installation. If you prefer a registry like zookeeper, please check out examples here.