@Service public class HelloServiceImpl implements HelloService { @Override public String sayHello(String name) { return "Hello " + name; } } <dubbo:protocol name="dubbo" port="20880" /> <dubbo:service interface="com.example.HelloService" ref="helloService" /> <bean id="helloService" class="com.example.HelloServiceImpl" /> public class HelloServiceConsumer { public static void main(String[] args) { HelloService helloService = (HelloService) DubboUtils.getService(HelloService.class); String result = helloService.sayHello("Dubbo"); System.out.println(result); } } <dubbo:reference id="helloService" interface="com.example.HelloService" /> <bean id="helloServiceConsumer" class="com.example.HelloServiceConsumer" />


上一篇:
下一篇:
切换中文