一、历史回顾
(一)、历史回顾
二、Zookeeper - Dubbo - SSM - Maven架构
(一)、Zookeeper - Dubbo - SSM - Maven架构图

(二)、架构搭建
1、新建父工程_COMMONS(管理jar包)
A、操作步骤:建一个pom的Maven项目
pom.xml配置:(这里引入POJO项目GAV)




B、如果中央仓库不存在jar包,将本地jar安装在maven本地仓库:mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=10.2.0.5.0 -Dpackaging=jar -Dfile=d:\ojdbc7.jar
按照这个例子命令进行修改,要在仓库目录下执行,我本地的仓库是在E:\Maven_LocalRepository。在这个目录下执行上面的例子样的命令。
2、新建父工程_POJO(管理实体类)
A、操作步骤:新建一个jar的Maven项目
pom.xml配置:

B、新建实体类:

3、新建父工程_COMMON_INTERFACE(公共接口)
A、操作步骤:新建一个jar的Maven项目,该pom里面设置POJO的依赖
pom.xml配置:

B、新建接口:

4、新建提供者工程(Dao):
A、操作步骤:新建一个jar的Maven项目,并且将工程_COMMONS当做父工程
pom.xml配置:

B、配置文件:
spring-mybatis.xml:

db.properties配置:

xxxMapper.xml:

C、代码:
xxxMapper接口:

5、新建工程提供者(Service):
A、操作步骤:新建一个war的Maven项目,并且将工程_COMMONS当做父工程,并且引入Dao、Service接口。
最后配置一个内置的tomcat。
pom.xml配置:


B、配置文件:
web.xml中集成Spring信息:

applicationContext.xml配置:

C、接口实现代码:

6、新建工程Web消费者(Consumer):
A、操作步骤:新建一个war的Maven项目,并且将工程_COMMONS当做父工程,并且引入Service接口。
pom.xml配置:


B、配置文件:
web.xml:

springmvc.xml:

C、编写代码:
Controller代码:

7、将工程依次install依次
MZZY_POJO ---> MZZY_Commons、MZZY_Common_Interface ---> MZZY_Dao ---> MZZY_Service ---> MZZY_Web
8、启动
A、启动zookeeper:进入zookeeper的软件安装bin目录下,点击zkServer.cmd
B、启动提供者:


C、启动消费者


网友评论