您好,登錄后才能下訂單哦!
dubbo 2.5.x 及 2.5.x以前的版本,用zkclient操作zookeeper
pom.xml配置:
<dependency> ????<groupId>com.alibaba</groupId> ????<artifactId>dubbo</artifactId> ????<version>2.5.6</version> </dependency> <!--?zkclient?--> <dependency> ????<groupId>com.101tec</groupId> ????<artifactId>zkclient</artifactId> ????<version>0.10</version> </dependency>
applicationContext.xml文件頭配置:(注意命名空間)
<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.3.xsd? ????http://code.alibabatech.com/schema/dubbo?http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
dubbo 2.6.x及以后的版本,用curator操作zookeeper
pom.xml配置:
<dependency> ????<groupId>com.alibaba</groupId> ????<artifactId>dubbo</artifactId> ????<version>2.6.2</version> </dependency> <!--?curator?--> <dependency> ????<groupId>org.apache.curator</groupId> ????<artifactId>curator-framework</artifactId> ????<version>2.12.0</version> </dependency>
applicationContext.xml文件頭配置:(注意命名空間)
<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">
注:2.6.x以后集成spring,命名空間也要修改,否則會有如下異常:
Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://dubbo.apache.org/schema/dubbo]
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。