分模块
分模块开发有利于管理与开发。
本质是把每一个模块都当成一个项目
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