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);