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. 洛谷 P1019单词接龙

    看吧,多简单啊,没有人受伤的世界完成了.                                                                                ...

  2. python中浅拷贝和深拷贝分析

    首先,我们知道Python3中,有6个标准的数据类型,他们又分为可以变和不可变.不可变:Number(数字).String(字符串).Tuple(元组).可以变:List(列表).Dictionary ...

  3. golang使用注意事项

    1.可以给类型取别名,但是该类型和别名是两个不同的类型: type myInt int 2.go支持可变参数:args... 0个或多个参数:func sum(args... int) sum int ...

  4. Spring (4)框架

    Spring第四天讲义 今日内容 Spring的事务管理 Spring和MyBatis框架的集成 1. Spring的事务管理 1.1. 事务是什么? 在操作数据库时(增删改),如果同时操作多次数据, ...

  5. 关于UBOOT,LINUX内核编译,根文件系统的15个小问题

    (1)内核默认运行地址和加载地址在哪里设置? 由 arch/arm/kernel/vmlinux.lds.S 生成的 arch/armkernel/vmlinux.lds决定   (2)从FLASH什 ...

  6. HTTP参数污染(参数处理图)

  7. input 默认提示文字 样式修改(颜色,大小,位置)

    input::-webkit-input-placeholder{ color:red; font-size:20px; ...... }

  8. modelsim仿真xilinx ram输出均为0

    现象 在vivado2018.3下生成了RAM IP,丢到modelsim中仿真发现doutb输出均为0.调整AB端口的时钟速率,发现低于5ns不行,输出为0.但5ns以上正常. 解决方法 比对了vi ...

  9. ubuntu16.04安装aquatone

    很坑   网上的那些教程 不知道怎么搞得....  误人子弟 首先 一台服务器  ubuntu16.04 首先aquatone   github  https://github.com/michenr ...

  10. iOS8中UIActionSheet弹出UIImagePickerController异常处理

    iOS8之后,UIActionSheet改父于UIAlertController.带来了一丢丢兼容性的问题. 比如在弹出的actionsheet中选择从相册选择图片或者拍照,之后弹出UIImagePi ...