# plasticene-boot-starter-parent
**Repository Path**: plasticene3/plasticene-boot-starter-parent
## Basic Information
- **Project Name**: plasticene-boot-starter-parent
- **Description**: 基于SpringBoot2.x、SpringCloud和SpringCloudAlibaba企业级系统架构底层框架封装,解决业务开发时常见的非功能性需求,防止重复造轮子,方便业务快速开发和企业技术栈框架统一管理。引入组件化的思想实现高内聚低耦合并且高度可配置化,做到可插拔。严格控制包依赖和统一版本管理,做到最少化依赖。注重代码规范和注释,非常适合个人学习和企业使用
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: https://gitee.com/plasticene3/plasticene-boot-starter-parent/wikis
- **GVP Project**: No
## Statistics
- **Stars**: 178
- **Forks**: 88
- **Created**: 2022-07-14
- **Last Updated**: 2025-09-11
## Categories & Tags
**Categories**: Uncategorized
**Tags**: 企业级框架, starter, 系统架构, 底层封装, 脚手架
## README
# plasticene-boot-starter-parent
当前最新版本`2025.3.0`,也就是在今年2025的3月份,将本项目从`Spring Boot 2.7.0`升级到当时最新版本`Spring Boot 3.4.5`,Java从8升级到了17,并承诺以后会持续封装、集成组件带来新亮点、新功能。欢迎大家提出好的idea
## 1.项目介绍
### 1.1 项目概述
- **基于SpringBoot3.4.5、SpringCloud2024.0.0和SpringCloudAlibaba2023.0.3.2企业级系统架构底层框架封装**。
- 解决业务开发时常见的**非交互功能性需求**,防止重复造轮子,方便业务快速整合开发和企业技术栈框架统一管理。
- **引入组件化的思想实现高内聚低耦合并且高度可配置化,做到可插拔**。
- 严格控制包依赖和统一版本管理,做到**最少化依赖**。依赖版本采用最新且稳定版本原则,避免依赖漏洞。
- 注重代码规范和注释,遵循alibaba Java开发手册,利用IDE代码检查消除一切代码警告⚠️,非常适合个人学习和企业使用。
### 1.2 实现功能概述:
这里只对功能进行概述,细节实现请从下面的模块说明跳转查看每个模块下核心功能点的实现详解文档
- **高度封装自定义`web starter`实现如下功能**
- 对`Spring MVC`的统一配置时区、时间格式,响应结果JSON是否显示null值等
- 全局异常和响应结果统一处理封装,有利于前后端联调、交互、UI展示
- 通过过滤器filter实现接口请求`traceId`链路追踪,方便定位一次请求日志上下文。
- 整合`TransmittableThreadLocal`分别重写了日志框架`logback`和`log4j2`对MDC的实现,解决线程池在多线程异步`traceId`传递问题
- 通过切面AOP实现接口请求参数、响应结果日志打印,方便查看核心接口请求参数和线上问题场景还原。
- 使用多种方案实现对接口数据进行加解密、签名验证等,提高接口数据安全性
- 数据脱敏展示,实现:"**想在哪脱就在哪脱,想脱谁就脱谁! ! !**"
- 扩展`ConstraintValidator`,实现复杂场景自定义参数校验组件,如枚举字段值是否合法,联合字段校验等
- 整合`Knife4j`输出接口文档,遵循OpenAPI3规范
- 封装自定义`redis starter`实现如下功能:
- 自定义注入`RedisTemplate`和`StringRedisTemplate`等bean,指定key、value序列化方式
- 基于注解通过`redis+lua`实现分布式限流
- 基于注解通过`Redisson`实现分布式锁
- 基于Redis pub/sub 消息机制,抽象封装消息监听器,统一注入、管理。
- 基于`Spring Cache`框架,整合`caffeine+redis`实现多级缓存
- 基于mybatis-plus封装实现**分页、多租户插件,公共属性自动填充,复杂字段类型处理,字段数据加密**,逻辑删除等。
- 基于redis实现**分布式限流注解**,基于Redisson实现**分布式锁注解**,以及对redis常用命令和组件的封装
- 实现**license证书生成与检验**,只需引入依赖,**开箱即用**。
- 实现web设置接口traceId实现**链路追踪**,**接口访问日志打印**,**全局异常和响应结果统一处理封装**,整合接口文档knife框架等
- 自定义启动banner图案和控制台打印
- 基于**TransmittableThreadLocal封装线程池**实现父子线程之间的数据传递
- 封装公共pojo类、业务异常类、工具类
**开发文档**:https://github.com/plasticene/plasticene-boot-starter-parent/wiki
**Github地址**:https://github.com/plasticene/plasticene-boot-starter-parent
**Gitee地址**:https://gitee.com/plasticene3/plasticene-boot-starter-parent
## 2.项目结构
**模块结构**
```lua
plasticene-boot-starter-parent -- 父项目
│ ├─plasticene-boot-starter-banner -- 图案
│ │─plasticene-boot-starter-cache -- 多级缓存
│ ├─plasticene-boot-starter-mybatis -- mybatis starter
│ ├─plasticene-boot-starter-redis -- redis starter
│ ├─plasticene-boot-starter-web -- web starter
│ ├─plasticene-boot-starter-license -- license starter
│ ├─plasticene-common -- 公共、基础
```
**代码结构:**
每个starter组件,包含两部分:
1. `core` 包:组件的核心封装,拓展相关的功能。
2. `autoconfigure` 包:组件的 Spring Boot 自动配置。
**模块说明**
| | 模块 | 功能 | 文档 |
| :--: | ------------------------------------------------------------ | ------------------------------------------------------------ | :----------------------------------------------------------: |
| 🚀 | [plasticene-boot-starter-parent](https://github.com/plasticene/plasticene-boot-starter-parent) | 父项目,统一依赖版本管理 | [plasticene-parent](https://github.com/plasticene/plasticene-boot-starter-parent/wiki) |
| 🚀 | [plasticene-boot-starter-banner](https://github.com/plasticene/plasticene-boot-starter-parent/tree/main/plasticene-boot-starter-banner) | 自定义项目启动图案,配置控制台打印相关信息等等 | |
| 🚀 | [plasticene-boot-starter-cache](https://github.com/plasticene/plasticene-boot-starter-parent/tree/main/plasticene-boot-starter-cache) | 基于spring cache实现多级缓存 | [cache](https://github.com/plasticene/plasticene-boot-starter-parent/wiki/multilevel-cache(%E5%A4%9A%E7%BA%A7%E7%BC%93%E5%AD%98)) |
| 🚀 | [plasticene-boot-starter-mybatis](https://github.com/plasticene/plasticene-boot-starter-parent/tree/main/plasticene-boot-starter-mybatis) | 基于mybatis-plus进行二次封装整合 | [mybatis](https://github.com/plasticene/plasticene-boot-starter-parent/wiki/mybatis%E4%BA%8C%E6%AC%A1%E5%B0%81%E8%A3%85starter) |
| 🚀 | [plasticene-boot-starter-redis](https://github.com/plasticene/plasticene-boot-starter-parent/tree/main/plasticene-boot-starter-redis) | 实现常规redis操作封装,基于redis实现分布式限流,基于redisson实现分布式锁 | [redis](https://github.com/plasticene/plasticene-boot-starter-parent/wiki/plasticene-boot-starter-redis) |
| 🚀 | [plasticene-boot-starter-web](https://github.com/plasticene/plasticene-boot-starter-parent/tree/main/plasticene-boot-starter-web) | 实现链路追踪traceId、接口请求日志打印、统计返回结构封装、全局异常处理、swagger配置等 | [web](https://github.com/plasticene/plasticene-boot-starter-parent/wiki/plasticene-boot-starter-web) |
| 🚀 | [plasticene-boot-starter-license](https://github.com/plasticene/plasticene-boot-starter-parent/tree/main/plasticene-boot-starter-license) | license版权证书生成与验证 | [license](https://github.com/plasticene/plasticene-boot-starter-parent/wiki/plasticene-boot-starter-license) |
| 🚀 | [plasticene-common](https://github.com/plasticene/plasticene-boot-starter-parent/tree/main/plasticene-common) | 定义公共pojo类、业务异常类、工具类,枚举,线程池等等 | |
## 3.技术选型
| 框架 | 说明 | 版本 |
| ------------------------------------------------------------ | --------------------- | ----------- |
| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.7.0 |
| [Spring Cloud](https://spring.io/projects/spring-cloud) | 微服务开发框架 | 2021.0.3 |
| [Spring Cloud Alibaba](https://spring.io/projects/spring-cloud-alibaba) | 微服务开发框架 | 2021.0.1.0 |
| [Openfeign](https://spring.io/projects/spring-cloud-openfeign) | 声明式 REST 客户端 | 3.1.3 |
| [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 |
| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.8 |
| [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.2 |
| [Redis](https://redis.io/) | key-value 数据库 | 5.0 |
| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.17.4 |
| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.20 |
| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.1.5.Final |
| [Knife4j](https://gitee.com/xiaoym/knife4j) | Swagger 增强 UI 实现 | 3.0.2 |
| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.11.2 |
| [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.16.14 |
| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.8.2 |
| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 4.0.0 |
| [Hutool](https://www.hutool.cn/docs/#/) | 常用工具类框架 | 5.7.20 |
| [transmittable-thread-local](https://github.com/alibaba/transmittable-thread-local) | 线程池异步上下文传递 | 2.12.2 |
| [caffeine](https://github.com/ben-manes/caffeine) | 高性能本地缓存之王 | 2.8.5 |
| [slf4j](https://www.slf4j.org/) | 日志框架 | 1.7.36 |
| [aspectj](https://www.eclipse.org/aspectj/) | 切面框架 | 1.9.6 |
| [truelicense](https://truelicense.namespace.global/) | license证书管理引擎 | 1.33 |
| [jdk](https://github.com/openjdk/jdk) | Java 开发工具包 | >=1.8 |
| [maven](https://maven.apache.org/) | Java 管理与构建工具 | >=3.5.0 |
## 4.使用示例
当前组件依赖暂时还未上传到maven中央仓库,所以需要自行克隆代码到本地install
- git clone https://github.com/plasticene/plasticene-boot-starter-parent.git
- cd plasticene-boot-starter-parent && mvn install
- have fun and enjoy.
在业务团队项目服务的工程中按下面引入`plasticene-boot-starter-parent`相关依赖即可:
```xml
plasticene-boot-starter-parent
com.plasticene.boot
1.0-SNAPSHOT
com.plasticene.boot
plasticene-boot-starter-banner
1.0-SNAPSHOT
com.plasticene.boot
plasticene-boot-starter-mybatis
1.0-SNAPSHOT
com.plasticene.boot
plasticene-boot-starter-web
1.0-SNAPSHOT
com.plasticene.boot
plasticene-boot-starter-redis
1.0-SNAPSHOT
com.plasticene.boot
plasticene-boot-starter-cache
1.0-SNAPSHOT
```
完整项目服务整合代码示例请看:https://github.com/plasticene/fast-api
## 5. 交流反馈
- 如果有问题或者其他交流,可以通过 [Github Issue](https://github.com/plasticene/plasticene-boot-starter-parent/issues)或者 [Gitee Issue](https://gitee.com/plasticene3/plasticene-boot-starter-parent/issues)进行反馈。提交`ISSUS`时,请务必写清楚问题的具体原因,重现步骤和环境(上下文),以便作者后期重现排查解决。
- 个人博客:http://www.shepherd126.top/
- 个人邮箱:shepherd_zfj@163.com
- 个人公众号:[Shepherd进阶笔记](https://camo.githubusercontent.com/1275dd8e8b4118823c0f8976f653945eafe77708877e832c59f9a4d9e9d31180/68747470733a2f2f6d61726b646f776e2d66696c652d7a666a2e6f73732d636e2d68616e677a686f752e616c6979756e63732e636f6d2f4f6666696369616c2532304163636f756e742e6a7067)