SpringBootUnity is a free, open source orchestration & scheduling project written in several languages and released under a custom open-source licence. It has 884 GitHub stars, 431 forks and 0 open issues, and was last pushed 12 days ago. On this registry it ranks #107 of 130 tracked projects in Orchestration & Scheduling, with 5 head-to-head comparisons available.

What is SpringBootUnity?

SpringBootUnity is an MIT-licensed, multi-module Spring Boot 4.1.1 project whose 30 modules each pair Spring Boot with a different technology, written for Java developers who need a runnable, isolated reference for one specific stack rather than a finished product.

What it is

SpringBootUnity is built on Spring Boot 4.1.1, targets JDK 21, builds with Maven 3.9+, and is maintained by houko under the MIT licence. It is not a product but a collection of usage examples: because requirements change, each technology combination lives in its own module, and every module can be packaged and started independently without affecting the others. The core module holds shared utilities, base classes, constants, exceptions and filters, is depended on by every other module, and cannot be run on its own. The remaining modules each demonstrate one technology and can be run one at a time to inspect that technology in isolation.

The concrete problem it solves is stack selection and reference. Instead of committing an application to a single persistence layer or HTTP client, the project shows working alternatives side by side. The mybatis module uses MyBatis as the persistence layer in place of JPA, and the httpinterface module uses the @HttpExchange declarative HTTP client instead of OpenFeign. Elsewhere, Spring Data JPA 7.x with Hibernate remains the default, and the cache module demonstrates the Spring Cache abstraction backed by Caffeine rather than a remote cache. The website module, started by XiaomoMain, combines JPA, FreeMarker pages and an OpenAPI interface and is described as the most complete module in the set.

Key capabilities

  • Thirty modules, each independently buildable and startable; core is the shared base package and cannot run alone.
  • socket module serves a WebSocket online chat on port 8081, while every other module listens on 8080, so only one module runs at a time.
  • Scheduling and background work through scheduled (@Scheduled), async (@Async), and aop, which uses a custom @Loggable annotation to record elapsed time and call counts.
  • Messaging coverage through rabbitmq (RabbitMQ send and receive) and kafka (KafkaTemplate with @KafkaListener).
  • Data layer coverage through mongodb, multipleSource (multi-datasource configuration and switching), flyway (Flyway migrations read back with JdbcTemplate), and elasticsearch (Spring Data Elasticsearch).
  • API documentation with springdoc-openapi 3.x exposing OpenAPI 3.1, monitoring with Micrometer and Spring Boot Actuator, and GraphQL through Spring GraphQL with GraphQL Java.
  • Request handling utilities including validation (@Valid / @Validated plus @RestControllerAdvice global exception handling), fileupload with path traversal protection, and ratelimit using a HandlerInterceptor and a fixed time window.

Who uses it and how

  • Java developers evaluating one technology: pick the single module of interest, start its main class, and study it without interference from the rest.
  • Teams that need a working Spring Boot example against MySQL, Redis, MongoDB, RabbitMQ, Kafka, Elasticsearch or an SMTP server, since each module lists the external services it requires.
  • Readers who treat tests as executable documentation: fourteen modules (validation, fileupload, restclient, cache, actuator, async, aop, httpinterface, i18n, ratelimit, graphql, kafka, mail, flyway) ship tests that need no external services, using embedded Kafka, GreenMail embedded SMTP and embedded H2 respectively.
  • Contributors adding further Spring Boot technology examples by pull request; the repository shows 885 stars, 432 forks and no open issues.

Getting started

Build with Maven 3.9+ on JDK 21+, then start the main class of the module of interest, such as XiaomoMain for website or ChatMain for socket, after supplying whatever external service that module declares. Running mvn test executes the fourteen self-contained test suites.

How it compares

The facts list no paid products that this project replaces, and they name no comparable tools. SpringBootUnity stands alone in this registry.

When to use it — and when not to

A self-hoster must operate external services per module, which means MySQL, Redis, MongoDB, RabbitMQ, Kafka, Elasticsearch or an SMTP server depending on the example being run, and must run only one module at a time because they share port 8080. Anyone wanting a drop-in library, a single deployable artifact, or a Docker image or compose file will not find one here, and the README is written in Chinese. It is best treated as a working reference to read and adapt, not as a foundation to depend on in production.

project readme (upstream, from github) — read inline

Build CodeQL GitHub license Spring Boot JDK GitHub issues Backers on Open Collective Sponsors on Open Collective

SpringBootUnity

mark

项目简介

需求是多变的。本项目以 Spring Boot 为基础,针对不同需求把不同的技术和 Spring Boot 搭配起来,每一种搭配单独做成一个模块,因此它是一个偏使用示例的集合而非一个完整产品。

每个模块都能独立打包、独立启动,互不影响,可以只挑自己关心的那一个跑起来看。如果你在使用 Spring Boot 的过程中有什么好用的技术,欢迎提 PR。

模块一览

一共 30 个模块。core 是被其他模块共同依赖的基础包,其余每个模块各自演示一项技术。

模块 演示内容 启动类 需要的外部服务
core 公共基础包:工具类、基类、常量、异常、过滤器。被所有模块依赖,不可独立运行 — —
website 个人站点:JPA + FreeMarker 页面 + OpenAPI 接口,模块中最完整的一个 XiaomoMain MySQL、Redis
javase Java SE 题库接口,JPA + OpenAPI 的典型增删改查 QuestionMain MySQL
order 订单接口,含 zxing 二维码生成 OrderMain —
mongodb MongoDB 文档数据库读写 MongodbMain MongoDB
mybatis MyBatis 替代 JPA 作为持久层 MybatisMain MySQL
multipleSource 多数据源配置与切换 MultipleSourceMain MySQL ×2
redis Redis 缓存读写与定时刷新 RedisMain Redis
rabbitmq RabbitMQ 消息收发 RabbitMqMain RabbitMQ
security Spring Security 表单登录与鉴权 SecurityMain —
socket WebSocket 在线聊天,端口 8081 ChatMain —
scheduled @Scheduled 定时任务 ScheduledMain —
async @Async 异步任务 AsyncMain —
crawler jsoup 网络爬虫(阴阳师式神数据),抓取后落库 CrawlerMain MySQL
freemarker FreeMarker 模板引擎 FreemarkerMain —
thymeleaf Thymeleaf 模板引擎 ThymeleafMain —
validation 参数校验(@Valid / @Validated)与 @RestControllerAdvice 全局异常处理 ValidationMain —
fileupload 文件上传下载,含路径穿越防护 FileUploadMain —
restclient 用 RestClient 调用外部 HTTP 服务 RestClientMain —
cache Spring Cache 抽象 + Caffeine 本地缓存 CacheMain —
actuator 健康检查、自定义 HealthIndicator 与业务指标 ActuatorMain —
aop AOP 切面:自定义 @Loggable 注解记录耗时与调用次数 AopMain —
httpinterface @HttpExchange 声明式 HTTP 客户端(代替 OpenFeign) HttpInterfaceMain —
i18n 国际化:MessageSource + LocaleResolver 多语言文案 I18nMain —
ratelimit 接口限流:HandlerInterceptor + 固定时间窗口 RateLimitMain —
graphql GraphQL 查询接口(@QueryMapping + schema) GraphqlMain —
kafka Kafka 消息收发(KafkaTemplate + @KafkaListener) KafkaMain Kafka
mail 邮件发送(SimpleMailMessage / MimeMessageHelper) MailMain SMTP 服务器
elasticsearch Spring Data Elasticsearch 文档检索 ElasticsearchMain Elasticsearch
flyway Flyway 数据库迁移 + JdbcTemplate 读取 FlywayMain MySQL

除 socket 使用 8081 外,其余模块都监听 8080,所以一次只启动一个模块。

其中 validation、fileupload、restclient、cache、actuator、async、aop、httpinterface、i18n、ratelimit、graphql、kafka、mail、flyway 十四个模块附带可直接运行的测试。它们的测试都不依赖外部服务——kafka 用内嵌 Kafka、mail 用 GreenMail 内嵌 SMTP、flyway 用内嵌 H2,其余用 Spring 测试上下文;mvn test 即可跑通,也可以当作各自技术点的可执行文档来读。

技术栈

组件 版本
Spring Boot 4.1.1
JDK 21(编译目标;CI 同时在 21 和 25 上构建)
Maven 3.9+
Hibernate / Spring Data JPA 7.x
Jackson 3.x
API 文档 springdoc-openapi 3.x(OpenAPI 3.1)
数据库驱动 MySQL Connector/J
缓存 Caffeine(cache 模块)
监控 Micrometer + Spring Boot Actuator(actuator 模块)
AOP AspectJ(aop 模块)
GraphQL Spring GraphQL + GraphQL Java(graphql 模块)
消息 Spring for Apache Kafka(kafka 模块)
邮件 Spring Mail + Jakarta Mail(mail 模块)
搜索引擎 Spring Data Elasticsearch(elasticsearch 模块)
数据库迁移 Flyway(flyway 模块)
其他 MyBatis、Lettuce(Redis)、jsoup、Apache POI、fastjson2、zxing

Spring、Jackson、Hibernate、JUnit 等版本统一由 spring-boot-dependencies BOM 管理,不在本项目中单独指定。

环境要求

  • JDK 21 或更高(Spring Boot 4 的最低要求是 17)
  • Maven 3.9 或更高
  • 按需准备对应模块的外部服务(见上表),只跑不需要外部服务的模块则无需任何准备

快速开始

构建全部模块:

mvn clean install

启动某一个模块,例如不依赖任何外部服务的 order:

java -jar order/target/order-2020.1.jar

也可以用 Maven 直接跑:

mvn spring-boot:run -pl order

在 IDE 中则找到对应模块的 *Main 类直接运行即可。

跑测试:

mvn test

run

部署到服务器时,Spring Boot 内置了 Tomcat,把打好的 jar 传上去执行就可以:

java -Xms64m -Xmx2048m -jar order-2020.1.jar >> ./order.log 2>&1 &

API 文档

带有 OpenAPI 注解的模块(website、javase、order、mongodb)启动后可访问:

  • Swagger UI:
  • OpenAPI 描述文档:

swagger

配置说明

每个模块的配置在各自的 src/main/resources/config/application.properties,日志配置在同目录的 logback-dev.xml。

需要注意:

  • 涉及数据库的模块请先修改 spring.datasource.* 中的连接信息。多数模块使用 Hibernate 的 ddl-auto=update,在没有提供 sql 文件时会依据实体类映射自动建表。
  • 仓库里的账号密码全部是占位符,不要把真实凭据提交进版本库。core/src/main/resources/config/oauth.properties 中的第三方登录密钥同理,请填入自己申请的值,或改为从环境变量注入。

打包成 war

如果需要部署到外部 Tomcat,在对应模块的 pom.xml 中改打包方式即可:

<packaging>war</packaging>

更新日志

完整记录见 changeLog.md,以下为主要节点:

  • 2026-09-09 升级到 Spring Boot 4.1.1、JDK 21,全部依赖更新到最新版本;javax.* 迁移到 jakarta.*;API 文档从已停止维护的 springfox 迁移到 springdoc-openapi;security 模块改用 SecurityFilterChain 组件式配置;fastjson 迁移到 fastjson2,Jackson 升级到 3.x,POI 升级到 5.x;新增 GitHub Actions 构建 CI
  • 2020-10-09 升级到 Spring Boot 2.3.0、JDK 11,MySQL Connector 升级到 8
  • 2018-04-09 升级到 Spring Boot 2.0 release,API 有较大变动
  • 2017-11-03 合并 api 和 website 模块;按阿里巴巴编程规范 P3C 优化代码
  • 2017-11-02 开源协议从 Apache 更换为 MIT
  • 2017-09-08 crawler 模块修复本地目录不存在时报错的问题

项目状态

本项目定位是示例集合,模块按需增删。欢迎通过 issue 反馈问题或提出想看到的技术搭配。

本项目同时托管在 GitHub 和 Gitee,以 GitHub 为准。

贡献者

感谢所有为本项目做出贡献的开发者们.

支持者

感谢您的支持! 🙏 [成为支持者]

赞助商

[成为赞助商]支持本项目并成为赞助商. 您的 LOGO 和网站链接将会被展示在这里.

关于我

@小莫:热爱开源、追求新潮的开发者,习惯以 GitHub 的 issue 驱动方式组织自己的项目。熟悉游戏开发和 Web 开发,目前任 RPG 服务端主程。也是个喜欢二次元的死宅,爱动漫,略懂日语。

欢迎联系一起进步:

  • Issue:
  • 个人主站:
  • QQ:83387856

相关链接

License

MIT © Peng Hu

Frequently asked questions

Is SpringBootUnity free to use?

SpringBootUnity is open source. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does SpringBootUnity do?

rabbitmq、redis、scheduled、socket、mongodb、Swagger2、spring data jpa、Thymeleaf、freemarker etc. (muti module spring boot project) (with spring boot framework,differe

What is SpringBootUnity written in?

SpringBootUnity's source is publicly available at https://github.com/houko/SpringBootUnity, with 884 GitHub stars.