springboot 分布式项目,子级项目各自的作用。
2024-09-06 07:09:20
一、分布式项目,需要使用maven搭建。
1.1 父级pro.xml module。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.aaa</groupId>
<artifactId>2019816SpringBootCRUD</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version> <modules>
<!--1.实体类 -->
<module>model</module> <!--2.持久层 依赖于model-->
<module>mapper</module> <!-- 3.页面层 1.依赖service层 2.不允许出现任何逻辑 负责控制跳转。-->
<module>web</module> <!--4.业务层 4.1依赖mapper 4.2 依赖common 工具包-->
<module>service</module> <!-- 5.工具类 放在service层使用。 -->
<module>common</module>
</modules> <!--dependencyManagement 标签管理的各种jar包,子级的工程,通过重写的方式来继承。 -->
<dependencyManagement>
<dependencies> <!-- 将父工程 parent 放在里面 parent 和 web 项目就能跑了 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.22.RELEASE</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.22.RELEASE</version>
</dependency> <!--
1.添加 thymeleaf 的依赖。
2.springboot 中已经继承过了,可以直接使用。
3.添加版本号 此时已经是 父级工程了。
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>1.5.22.RELEASE</version>
</dependency> <dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.21</version>
</dependency> <!--
mybatis jar包 mysql jar包 引入在父级之中,mapper层 就能用到了
mapper 和web 用到相同的( 连接数据库 做增删改查)
在mapper中放入即可。
-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<!--
mysql的驱动包
-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
1.2 子级项目之间的依赖关系、
mapper-----》 依赖 model
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>2019816SpringBootCRUD</artifactId>
<groupId>com.aaa</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion> <artifactId>mapper</artifactId> <!--mapper 依赖 model -->
<dependencies>
<dependency>
<groupId>com.aaa</groupId>
<artifactId>model</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- 1.mapper 层 需要用到 父级工程中的jar 包,在这里重写即可。
2.web 层也需要用到,但是层级依赖 已经确定,只需要在mapper层中,重写即可。
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> </dependency>
<!--
mysql的驱动包
-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
</project>
service-------》mapper
web------》service
最新文章
- sys.syslockinfo--master..syslockinfo
- [译]Mongoose指南 - Population
- 【读书笔记】iOS-内存释放
- c#上利用NPlot实现动态曲线图需要的dll文件
- 讓 SourceTree 讀取自定的 SSH key
- Ch06 验证
- 图片本地预览 flash html5
- 大IT公司笔试
- 【蓝牙数据采集模块】-02-Sensor Controller 编写CC2650STK外设驱动
- 【bzoj2819】Nim
- 75、django之ORM补充
- 8086的分段寻址技术学习总结(Segmented Addressing)
- VMware ESXi 6.5 安装
- 网页中嵌入google地图
- Java重排序
- Latex: 保持参考文献大小写
- input 修改placeholder颜色
- HanLP用户自定义词典源码分析详解
- 再说Android RecyclerView局部刷新那个坑
- [Selenium] jsclick
热门文章
- The Balance(poj2142)
- sql注入 —sqli-labs/Less-5 逻辑注入
- 【因果推断经典论文】Direct and Indirect Effects - Judea Pearl
- Linux环境下Django App部署到XAMPP上
- Vue.js高效前端开发 • 【Vue组件】
- Linux系统使用crt登录之后如何显示横幅消息
- java 短路与(||)时报错The operator || is undefined for the argument type(s) int, boolean
- solr -创建 core
- Linux上天之路(十五)之文件查找
- Java实现163邮箱发送邮件到QQ邮箱