Skip to content

简介

     Spring%20Boot Version

zebra是基于SpringBoot封装的增强框架,基于“约定优于配置”的理念,再次精简常规配置, 内置丰富的实用工具,异常处理并优化Spring环境配置和完善的规约限制并 提供一个更为完整的配置解决方案,帮助开发人员更加快速的集成常用第三方库或工具到 Spring Boot Web 应用程序中, 其目的是建立统一基础技术框架,建立可积累,可复用的组件库,促进开发人员复用,提升研发质量和效率。

源码地址

https://gitee.com/zhanghongbin/zebra

环境说明

下方为本项目后端所需运行环境,请注意检查您的环境是否与本项目所需一致,以减少环境引起的问题。

运行环境最低版本
JDK(openjdk,LibericaJDK)11
Maven3.9.4

最新稳定版

Release

工程结构

zebra 工程为多级 module 组成:

. zebra-spring-boot
├──zebra-spring-boot-dependencies             所有库依赖配置-父模块
├──zebra-spring-boot-starter                  starter父模块
  ├──zebra-spring-boot-starter-web            web核心增强模块提供全局异常处理及响应封装和多种类型注解等
  ├──zebra-spring-boot-starter-mybatis-plus   mybatis plus 增强并整合了mybatis-plus-join和stream-query第三方框架
  ├──zebra-spring-boot-starter-logging        行为日志,系统日志规范化及sentry日志平台的整合
  ├──zebra-spring-boot-starter-monitoring     服务监控整合admin,koTime等
  ├──zebra-spring-boot-starter-cache          基于redis封装,并整合了jetcache
  ├──zebra-spring-boot-starter-redisson       基于redisson封装和扩展,简化其操作
  ├──zebra-spring-boot-starter-rabbitmq       基于rabbitmq封装和扩展,简化其操作
  ├──zebra-spring-boot-starter-satoken        satoken中redis 采用msgpack序列化
  ├──zebra-spring-boot-starter-bean-searcher  简化复杂查询
  ├──zebra-spring-boot-starter-tenant         多租户
  ├──zebra-spring-boot-starter-captcha        验证码(包括图片,短信和邮件)
  ├──zebra-spring-boot-starter-file           excel 导入导出,文件格式转换等
  ├──zebra-spring-boot-starter-message        基于sms4j进行封装,发送短信,邮件及钉钉等消息
  ├──zebra-spring-boot-starter-trans          字典翻译
  ├──zebra-spring-boot-starter-i18n           国际化
  ├──zebra-spring-boot-starter-cdc            数据同步
├──zebra-spring-boot-common                   基础库公共模块

第三方及依赖库

名称版本用途描述
springboot2.7.18使用
mybatis-plus3.5.5使用
knife4j-openapi2-spring-boot-starter4.5.0使用接口文档
lombok1.18.30使用
druid-spring-boot-starter1.2.22使用
hutool5.8.24使用
flyway8.5.13声明数据库版本控制->参见 Java开发须知规约手册中 13.数据库规约
jetcache2.7.4声明文档参见 网址
postgresql42.2.18声明
mybatis-plus-join1.4.11使用文档参见 [网址](https://gitee.com/mhb0409/mybatis-plus-join
stream-plugin-mybatis-plus2.0.3使用文档参见 [网址](https://gitee.com/dromara/stream-query#https://gitee.com/link?target=http%3A%2F%2Fstream-query.dromara.org
freemarker2.3.32使用模板框架
guava28.0-jre依赖
commons-pool22.12.0声明
sentry7.3.0使用
snakeyaml1.30使用
velocity2.3使用
mapstruct-plus1.3.6使用Mapstruct Plus 是 Mapstruct 的增强工具,在 Mapstruct 的基础上,实现了自动生成 文档参见 [网址] https://www.mapstruct.plus/
javers-core7.4.1声明比较两个对象之间差异
tlog1.5.1使用日志跟踪框架
fastjson2.0.46依赖
caffeine3.1.8依赖
commons-io2.15.0声明
commons-lang33.12.0依赖
commons-lang2.6依赖
commons-beanutils1.9.4依赖
lock4j2.2.7声明分布式锁 文档参见 [网址] https://gitee.com/baomidou/lock4j
transmittable-thread-local2.14.4使用
bcprov-jdk15on1.70使用
mysql8.0.33声明
sa-token-spring-boot-starter1.38.0使用
sa-token-jwt1.38.0使用
x-file-storage-spring2.1.0使用
sms4j-spring-boot-starter3.2.1使用短信,邮件等
easyexcel4.0.1使用excel库
deepoove1.12.2使用word模版库
thumbnailator0.4.20声明图片库

快速开始

采用代码生成工具建立项目脚手架,以便快速启动项目。

代码生成工具 ( 版本<=1.2.1 )

通过arthetype生成项目脚手架,有以下两种方式生成:
1. cmd命令方式,打开shell输入以下命令 把 -DgroupId , -DartifactId 和 -Dversion 换成自己需要的。(注:maven settings.xml 最好配置好阿里云镜像加快下载速度)

shell
mvn archetype:generate -DgroupId=xxx.xx.x -DartifactId=x-x-x -Dversion=1.0.0-SNAPSHOT  -DarchetypeGroupId=io.github.zhanghongbin -DarchetypeArtifactId=zebra-archetype-service-single -DarchetypeVersion=1.0.4

2. 通过开发工具idea方式
idea默认使用的是用户目录下.m2里的settings.xml文件,最好把自己的配置好的 settings.xml 进行覆盖加快下载速度
如图按步骤进行填写

alt text
alt text
alt text 最后生成项目模板如下: alt text

代码生成工具 ( 版本>1.2.1 )

1. 访问在线代码生成器 -> http://codegen.zhanghongbin.xyz
2. 独立部署代码生成器参见网址 -> https://docs.ballcat.org/codegen/

第一步:选择单模块或多模块脚手架

alt text

第二步:填写右侧信息

alt text

第三步:点击打包下载

alt text