文章目录
- 一、聚合项目架构
- 二、依赖传递图解
- 2.1. 常见场景
- 2.2. 企业场景
- 三、结构设计原则
- 3.1. 模块层次清晰
- 3.2. 模块之间耦合度低
- 3.3. 功能互不影响
- 3.4. 定位问题效率高
- 3.5. 灵活易扩展
- 四、架构设计优点
- 4.1. 统一规范
- 4.2. 版本统一管理
- 4.2.1. 模块版本统一管理
- 4.2.2. 依赖版本统一控制
- 五、父工程构成
- 5.1. 独有pom
- 5.2. pom组成部分
- ①SpringBoot 父项目
- ② 版本控制标签` `
- ③子工程
- ④父项目标识
- ⑤编译扫描插件
- 六、子工程构成
- 6.1. aggregation-web
- 6.2. 常见即可
一、聚合项目架构
工程结构 | 说明 | 父/子工程 |
aggregation-parent | 全局版本控制模块 | 父 |
aggregation-web | 服务统一访问入口 | 子 |
aggregation-flowable | 工作流引擎模块 | 子 |
aggregation-system | 核心系统模块 | 子 |
aggregation-service | 业务逻辑核心模块 | 子 |
aggregation-interface | 公用API接口模块 | 子 |
aggregation-core | 公共技术核心模块 | 子 |
二、依赖传递图解
2.1. 常见场景
aggregation-core->
aggregation-interface->
aggregation-service->
aggregation-web
2.2. 企业场景
core->interface->service
-> flowable
->web
->system
三、结构设计原则
3.1. 模块层次清晰
3.2. 模块之间耦合度低
3.3. 功能互不影响
3.4. 定位问题效率高
3.5. 灵活易扩展
四、架构设计优点
4.1. 统一规范
4.2. 版本统一管理
4.2.1. 模块版本统一管理
只需在父工程设置版本号,其他子工程无需再次设置版本号
4.2.2. 依赖版本统一控制
①公用依赖统一在父工程中进行版本控制,其他子工程依赖传递即可
②每个子工程,独有的依赖,也就是此以来只有你的模块用到,在自己的模块直接集成即可。
五、父工程构成
5.1. 独有pom
5.2. pom组成部分
①SpringBoot 父项目
<!--SpringBoot parent基础嘉集成初始化内置-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
② 版本控制标签
<properties>
<!--全局编码设置-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!--JDK版本-->
<java.version>1.8</java.version>
<!--全局版本管理-->
<mysql-connector-java.version>8.0.13</mysql-connector-java.version>
<maven-resources.version>3.1.0</maven-resources.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
</properties>
③子工程
<!--子工程-->
<modules>
<!--业公共技术核心模块-->
<module>aggregation-core</module>
<!--公用API接口模块-->
<module>aggregation-interface</module>
<!--业务逻辑核心模块-->
<module>aggregation-service</module>
<!--核心系统模块-->
<module>aggregation-system</module>
<!--工作流引擎模块-->
<module>aggregation-flowable</module>
<!--服务统一访问入口-->
<module>aggregation-web</module>
</modules>
④父项目标识
<groupId>com.gblfy</groupId>
<artifactId>aggregation-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
⑤编译扫描插件
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<delimiters>
<delimiter>@</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/webapp</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
六、子工程构成
6.1. aggregation-web
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<fork>true</fork><!-- 如果没有该项配置,devtools不会起作用,即应用不会restart -->
</configuration>
</plugin>
</plugins>
</build>
6.2. 常见即可
此pom配置可以解决登录404问题