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)完成整合

maven工程中dubbo与spring整合的更多相关文章

  1. maven工程中防止mapper.xml文件被漏掉、未加载的方法

    maven工程中防止mapper.xml文件被漏掉.未加载的方法 就是在pom.xml文件中添加以下内容 <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉. --&g ...

  2. 【Dubbo实战】 Dubbo+Zookeeper+Spring整合应用篇-Dubbo基于Zookeeper实现分布式服务(转)

    Dubbo与Zookeeper.Spring整合使用 Dubbo采用全Spring配置方式,透明化接入应用,对应用没有任何API侵入,只需用Spring加载Dubbo的配置即可,Dubbo基于Spri ...

  3. Dubbo+Zookeeper+Spring整合应用篇-Dubbo基于Zookeeper实现分布式服务(转)

    Dubbo与Zookeeper.Spring整合使用 Dubbo采用全Spring配置方式,透明化接入应用,对应用没有任何API侵入,只需用Spring加载Dubbo的配置即可,Dubbo基于Spri ...

  4. maven工程中pom.xml的错误

    更新maven工程,出现如下错误信息. Could not calculate build plan: Failure to transfer org.apache.maven.plugins:mav ...

  5. 在eclipse中的maven工程中执行maven命令的步骤

    执行maven命令的步骤: 1.找到maven工程的pom.xml文件,点中右键 2.在弹出的对话框中选择run as 3.在弹出的对话框中输入compile 再执行即可

  6. 如何在maven工程中加载oracle驱动

    maven中引入oracle驱动报错Missing artifact com.oracle:ojdbc14:jar:10.2.0.4.0 时间:2015年09月22日  浏览:9361次 在maven ...

  7. 如何在 Maven 工程中引入其他jar包 并生效?(以 Netty 为例)

    1.到 Maven 官网  查找 相关 框架 https://mvnrepository.com/artifact/io.netty/netty-all/4.1.32.Final 2.把相关 Xml体 ...

  8. 本地jar包在maven工程中pom引用

    背景   在使用Maven的过程中,经常碰到有些jar包在中央仓库没有的情况.如果公司有私服,那么就把jar包安装到私服上.如果没有私服,那就把jar包安装到本地Maven仓库.下面是如何把jar包导 ...

  9. 解决eclipse maven工程中src/main/resources目录下创建的文件夹所显示样式不是文件夹,而是"包"图标样式的问题

    参考:http://blog.csdn.net/luwei42768/article/details/72268246 eclipse项目中创建maven项目后,有时在执行命令maven update ...

随机推荐

  1. Ubuntu截图工具Flameshot

    今天来介绍一款Ubuntu下的截图工具,名叫Flameshot. 安装 Flameshot的安装很简单. 命令行安装 sudo apt-get install flameshot 一条命令搞定! 软件 ...

  2. hdu 6143

    题意:有m种字符,要求构造两段长度为n的字符串,其中这两段不能有相同的字符 枚举左边选了i种字符,右边可以选1,2....min(n,m-i)种字符 这样就把问题转化为用k种字符构造n长度的字符串的种 ...

  3. hdu 4501三重包问题

    好好理解一下背包问题 从01包入手 内层的循环 是为了以后求解记录数据 因为只有一个取舍问题 所以只需要一层循环就可以 这里有三个背包 钱 积分 以及免费物品 那么 就需要三重循环 #include& ...

  4. matlab cell

    cell元包是matlab中提供的一种数据类型,功能强大. 关于cell的创建: 1.跟一般创建举证一样,直接使用C = {A B D E}这种形式,不过这里把"[]"改成了}&q ...

  5. Go 代码风格和规范

    Go 语言写起来类似于C语言,因此熟悉C语言及其派生语言(C++.C#.Objective-C 等)的人都会迅速熟悉这门语言 编码风格 标识符命名规范 在习惯上,Go语言程序员推荐使用驼峰式命名,当名 ...

  6. springboot mvc自动配置(二)注册DispatcherServlet到ServletContext

    所有文章 https://www.cnblogs.com/lay2017/p/11775787.html 正文 上一篇文章中,我们看到了DispatcherServlet和DispatcherServ ...

  7. ajax检查用户名重复

    1.获取ajax对象 new XMLHttpRequest(); IE6-8: new ActiveXOject("Microsoft.XMLHTTP"); 兼容判断:if(XML ...

  8. 关于Objective C的私有函数

    (1)很多从其他语言(例如C++)转到objective c的初学者,往往会问到一个问题,如何定义类的私有函数?这里的“私有函数”指的是,某个函数只能在类的内部使用,不能在类的外部,或者派生类内部使用 ...

  9. ubuntu打开终端

    虚拟终端 Ctrl+Alt+T组合键 实际终端 Ctrl+Alt+F1 ~ F6组合键 可以在登录界面直接切换 退出终端 Ctrl+Alt+F7组合键

  10. string+DP leetcode-4.最长回文子串

    5. Longest Palindromic Substring 题面 Given a string s, find the longest palindromic substring in s. Y ...