官方文档

  http://dubbo.apache.org/en-us/docs/user/quick-start.html

  自己的

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd
"> <!-- provider's application name, used for tracing dependency relationship -->
<!-- 定义了服务提供名称 在duboo-admin 和duboo-monitor 会显示这个名称-->
<dubbo:application name="member-provider"/>
<!-- use multicast registry center to export service -->
<!-- 注册中心的地址 使用zookeeper 注册中心暴露服务,注意先要开启zookeeper -->
<dubbo:registry address="zookeeper://localhost:2181"/>
<!-- use dubbo protocol to export service on port -->
<!-- dubbo 服务的端口号 -->
<dubbo:protocol name="dubbo" port=""/>
<!-- service implementation, as same as regular local bean -->
<bean id="memberService" class="ch.modules.service.MemberServiceImpl"/>
<!-- declare the service interface to be exported -->
<!-- 声明要导出的服务 接口 -->
<dubbo:service interface="ch.modules.service.MemberService" ref="memberService"/>
</beans>

使用app方式进行启动

package ch;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;

/**
* Description:
*
* @author cy
* @date 2019年05月17日 17:56
* version 1.0
*/
public class AppMember { public static void main(String[] args) {
ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext("/duboo/provider.xml");
app.start();
System.out.println("会员服务已经启动!");
try {
System.in.read(); // 保持服务一直在运行
} catch (IOException e) {
e.printStackTrace();
}
}
}

  

05-21 13:46