宁波实训Day8:分模块与分布式开发

本文介绍了分模块开发和分布式开发的方法。分模块开发将每个模块视为独立项目,通过创建parent Maven项目管理和组织代码。分布式开发则采用Zookeeper+Dubbo,服务在Zookeeper上注册,通过Dubbo调用。在实践中要注意模块间依赖的正确配置,避免出现如SQL参数错位等细节问题。作者还分享了在开发中遇到的前端模板调整和分页插件问题的解决经验。
摘要由CSDN通过智能技术生成

分模块

分模块开发有利于管理与开发。
本质是把每一个模块都当成一个项目
a) Bean – dao – service – controller
b) 步骤:
i.创建一个空的maven项目当做parent
ii.导包
iii.创建空模块 – bean 、dao、service
iv.创建带webapp的controller项目
在这里插入图片描述
之后在每一个模块里编写对应的代码即可
要注意的是在父模块里的pom文件里编写所有的依赖
web层即controller层,包括页面

分布式开发

使用zookeeper + dubbo
模式类似于 java消费者-生产者模式

我们创建service – 发送到了zookeeper, 在项目中用dubbo去获取/调用service接口
步骤:
1.配置了zookeeper,并保证正常运行
2.创建了 ssmPro_ex_service
3.创建了 ssmPro_ex_service_impl - 导入配置文件和App.java运行文件
创建了ssmPro_ex_web - 导入配置文件

  • 注意导入的bean、service等各包都对不对!

zookeeper:

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=C:\\zookeeper\\store
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeepe
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值