文章目录
1 Springboot多模块开发总结
springboot-high
- springboot-common 公共模块 (DTO)
- springboot-domain 域模块(entity)(领域模型,完成实体类和表的映射)
- springboot-service 业务模块
一般一个项目,几十个模块,大模块下面有小模块,小模块下面有类和方法。
1.1 创建新项目
父模块不需要打包,设置内容为pom
1.引入依赖;模块中不需要进行源代码开发,所以删除src文件夹
2.new Mudule,添加三个新模块,springboot-common/domain/service
groupId: com.qfy.springboot.common/domain/service
<?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.qfy.springboot</groupId>
<artifactId>springboot-epi</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>springboot-common</module>
<module>springboot-domain</module>
<module>springboot-service</module>
</modules>
<packaging>pom</packaging><!--????-->
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.lombok.version>1.18.22</project.lombok.version>
<project.maven.version>3.1</project.maven.version>
<project.swagger.version>3.0.0</project.swagger.version><!--其他模块要用-->
<project.mysql.version>8.0.28</project.mysql.version>
<project.druid.version>1.2.8</project.druid.version>
<project.test.version>4.12</project.test.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.10</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<!--打包插件-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins