现在,我们的目标是将以上改为dubbo版,下面是我整理的一些步骤。
1、root.pom中添加依赖
com.alibaba
dubbo
${dubbo.version}
org.apache.zookeeper
zookeeper
${zookeeper.version}
com.github.sgroschupf
zkclient
${zkclient.version}
2.5.3
3.4.7
0.1
3、修改jarvis-manager-service中的pom文件,打包方式改为war,并添加dubbo的依赖
添加的内容如下:
com.alibaba
dubbo
org.springframework
spring
org.jboss.netty
netty
org.apache.zookeeper
zookeeper
com.github.sgroschupf
zkclient
5、配置表现层web:
web层的pom添加dubbo的jar包:
com.alibaba
dubbo
org.springframework
spring
org.jboss.netty
netty
org.apache.zookeeper
zookeeper
com.github.sgroschupf
zkclient
7、更改目录结构:
在文件夹中,将web剪切到与manager同一级别,重新在idea中导入web层
该目录结构如下:
9、web.pom中依赖service改为依赖api
10、由于web不依赖service了,则丢了对spring的依赖,需要在web的pom文件中添加对spring的依赖:
org.springframework
spring-context
org.springframework
spring-beans
org.springframework
spring-webmvc
org.springframework
spring-jdbc
org.springframework
spring-aspects
org.springframework
spring-jms
org.springframework
spring-context-support
Web.xml内容如下:
jarvis-manager
index.jsp
contextConfigLocation
classpath:spring/applicationContext*.xml
org.springframework.web.context.ContextLoaderListener
13、web的resource目录中,只留下springmvc.xml即可
jarvis-manager-web
index.jsp
CharacterEncodingFilter
org.springframework.web.filter.CharacterEncodingFilter
encoding
utf-8
CharacterEncodingFilter
/*
jarvis-manager-web
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:spring/springmvc.xml
1
jarvis-manager-web
/
至此,dubbo整合完毕。