Dubbo----Dubbo中Provider搭建

Provider搭建

=====这个是老版本的配置,可以了解下exclusions的用法=====

=====dubbo2.6.7可以直接如下配置=====

	<dependencies>
		<dependency>
			<groupId>com.kennosaur</groupId>
			<artifactId>dubbo_service</artifactId>
			<version>0.0.1-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>dubbo</artifactId>
			<version>2.6.7</version>
		</dependency>
		<dependency>
			<groupId>io.netty</groupId>
			<artifactId>netty-all</artifactId>
			<version>4.1.42.Final</version>
		</dependency>
		<dependency>
			<groupId>org.apache.curator</groupId>
			<artifactId>curator-framework</artifactId>
			<version>4.2.0</version>
		</dependency>


	</dependencies>

<?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://dubbo.apache.org/schema/dubbo"
	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">
	
	<!-- 提供方应用信息,用于计算依赖关系 -->
	<dubbo:application name="dubbo-service" />

	<!-- 使用multicast广播注册中心暴露服务地址 -->
	<dubbo:registry address="192.168.8.128:2181" protocol="zookeeper"/>

	<!-- 用dubbo协议在20880端口暴露服务 -->
	<dubbo:protocol name="dubbo" port="20880" />

	<!-- 声明需要暴露的服务接口 -->
	<dubbo:service
		interface="com.kennosaur.service.DemoService" ref="demoServiceImpl" />

	<!-- 和本地bean一样实现服务 -->
	<bean id="demoServiceImpl" class="com.kennosaur.service.impl.DemoServiceImpl" />
</beans>

ClassPathXmlApplicationContext  ac = new ClassPathXmlApplicationContext("applicationContext-dubbo.xml");
ac.start();
System.in.read(); // 按任意键退出

//官方推荐
//要求配置文件必须放在/META-INF/spring/*.xml
Main.main(args);

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值