zoukankan      html  css  js  c++  java
  • maven工程中dubbo与spring整合

    1)引入相应jar包

    <!-- 引入dubbo服务 start-->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>dubbo</artifactId>
                <version>2.5.3</version>
                <exclusions>  
                  <exclusion>  
                    <groupId>org.springframework</groupId>  
                    <artifactId>spring</artifactId>  
                  </exclusion>  
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.github.sgroschupf</groupId>
                <artifactId>zkclient</artifactId>
                <version>0.1</version>
            </dependency>
            <!-- 引入dubbo服务 end-->

    2)相应配置信息dubbo.xml

    <?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.xsd 
           http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
    
        <dubbo:application  name="demo-system" owner="demo-system"/>
    
        <dubbo:registry protocol="zookeeper" address="192.168.10.102:2181"/>
        
        <dubbo:protocol name="dubbo" port="-1" heartbeat="2000"/>
        
        <!-- 调用服务接口 -->
        <dubbo:reference id="dictionaryService" interface="com.iafclub.demo.remote.DictionaryService" check="false" timeout="10000"/>
        
        <!--提供服务接口-->
        <dubbo:service interface="com.iafclub.demo.remote.DictionaryService" ref="dictionaryServiceImpl"/>
    </beans>

    3)web.xml配置

        <!-- ContextLoaderListener初始化Spring上下文时需要使用到的contextConfigLocation参数 -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <!-- 配置spring.xml和spring-mybatis.xml这两个配置文件的位置,固定写法 -->
            <param-value>
                classpath:spring.xml,
                classpath:spring-mybatis.xml,
                classpath:spring-activitymq.xml,
                classpath:dubbo.xml,
                classpath:spring-redis.xml
            </param-value>
        </context-param>

    4)完成整合

  • 相关阅读:
    Sql server 2005 restore failed
    使用Windows Live Writer发布到cnblogs
    IE7 Tab problem
    转: 编码,charset,乱码,unicode,utf8与net简单释义(续)
    移动12.1号动感地带寻宝答案
    转: 各种 lightbox 实现
    Cannot connect windows 2003 server remotely by mstsc
    boost asio 网络编程案例简单改写
    读书笔记之《程序员的自我修养链接、装载与库》
    基于OpenSSL简单实现Shamir基于身份的数字签名算法
  • 原文地址:https://www.cnblogs.com/a393060727/p/5282765.html
Copyright © 2011-2022 走看看