一、构建springboot多模块项目
2019-06-14 本文已影响0人
shmilylyp
1、创建一个maven项目
1、根据提示填写相应内容一直下一步操作就可。

2、创建springboot项目
1、 右键点击上面已经创建的项目名称, new -> Module -> Spring Initializr


2、需要几个模块就创建几个moudle,我这里用web、service、dao、 bean来举例
创建后的目录结构:
·

3、在最外层的pom文件中添加信息


4、修改子模块信息
(1) 修改各个子模块的父组件

(2)web层需要添加service,bean的模块,service层添加dao,依次类推

(3)给各个模块添加一些代码进行测试
web:

servive:

dao:

测试结果:

备注:写这些的目的是为了把前一段时间做的项目总结记录一下。新入坑的程序猿,希望多多指教。开发期间通过百度参考了许多大神的作品,但是现在记不清有哪些了,如果有侵权的地方给我留言,我会把参考的地方加上。