AntonyCheng/spring-boot-init-template: a Spring Boot starter template with Spring AI and a large stack of integrations
基于 Java Web 项目的 SpringBoot 框架初始化模板,适配最新版本Spring AI,该模板整合了常用的框架(Mybatis-Plus、ShardingSphere、Redis、RabbitMQ、Elasticsearch、SaToken、OSS、Caffeine以及MongoDB等),广泛支持JDK11和JDK17,部分版本兼容JDK8,同时该模板适用于前后端分离项目启动开发,保证大家在此基础上能够快速开发自己的项目,同时也适合入门学习,本项目会由作者持续更新。
At a glance
- What is it?
- This Java template bundles MyBatis-Plus, ShardingSphere, Redis, RabbitMQ, Elasticsearch, SaToken, OSS, Caffeine and MongoDB on Spring Boot 3.2.5, and adds Spring AI. It is a starting point for backend projects, not a library you add to an existing one.
- Who is it for?
- Adopt it if you are starting a new Java web backend and want the integration work already done, and if you accept that you inherit every framework in the pom. Do not adopt it if you need a minimal dependency tree, or if you cannot run MySQL 8, Redis 7 and Elasticsearch 7.14.0.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 127 days ago.
- What is it written in?
- Mainly Java, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
The problem: assembling a Java web backend from a dozen libraries
Starting a Spring Boot service is easy. Starting one that already has authentication, a cache layer, a message queue, a search index, object storage and a scheduler takes a week of dependency alignment before any business code exists. This repository is that week, packaged as a template.
The README describes it as a SpringBoot framework initialization template for Java web projects, aimed at front-end and back-end separated development. The stated audience is developers who want to start their own project on top of it, plus people learning the stack. It is not a library. You clone it, delete what you do not want, and keep the rest.
The Spring Boot version is 3.2.5 on Java 17. The README says JDK 11 and JDK 17 are widely supported and that some versions are compatible with JDK 8, which matches the release naming: v2.2.0 shipped as v2.2.0-jdk17 and v2.2.0-jdk11. If you are on JDK 8, check the release list rather than the master branch.
How the template is put together: modules, profiles and one YAML per feature
The repository layout separates concerns cleanly. src/ holds the application, module/ holds the external platform integrations (XxlJob, PowerJob, SpringBootAdmin, Canal), sql/ holds the schema files, docker/ holds the container scripts, ui/ holds the front end, and pom.xml ties it together.
Configuration is profile based. The README states that after pulling the template you work in application-xxx.yaml files, and that related template features are introduced by editing the configuration as needed. That is the central design decision: the code for a feature is present, and a YAML block decides whether it is active. It means the template can carry Redis, Redisson, Caffeine, RabbitMQ, Elasticsearch, MongoDB, three object storage providers, captcha, mail and an offline IP database without forcing all of them on at once.
Two things are worth noting. First, the README says the README follows the version number and that all Git branches are preview branches, so the newest content is not always reflected in the README. It recommends downloading from Releases for a stable version with matching documentation. Second, the external platform modules carry an explicit warning: the README advises deploying XxlJob, PowerJob or SpringBootAdmin yourself with Docker in production rather than compiling the bundled module code, because the author modified parts of it to fit the template.
Installing it and getting a first response out of the service
The README's quick start has a mandatory step first: run three SQL files. They create the business database plus the XxlJob and PowerJob databases. The README lists them as sql/init_db.sql, sql/init_xxl_job.sql and sql/init_power_job.sql.
After that, the README says to make sure all dependencies are downloaded and then edit the application-xxx.yaml files for the features you want. The software requirements are explicit: MySQL 8.0.X is recommended, Redis 7.X.X is mandatory, Elasticsearch 7.X.X is mandatory with 7.14.0 particularly recommended, and RabbitMQ 3.X.X is recommended. Redis and Elasticsearch being mandatory is the first thing to check against your environment.
For a container route, the repository ships a Dockerfile that builds on openjdk:17.0.2-oraclelinux8, copies the built jar to /opt/spring-boot-init-template/app.jar, and exposes four ports: 38080, 38081, 38082 and 39999. The README also mentions Docker Compose scripts for one-click deployment. The Dockerfile expects the jar to already exist under target/, so build with Maven before building the image. The README documents no rollback procedure for a failed deployment.
The front end is a separate piece. The template uses vue-admin-template 4.4.0, which the README describes as a minimal Vue 2 and Element UI admin panel with axios, iconfont, permission control and lint. The ui/ directory in the repository is where that lives.
SaToken, caching and the authentication modes you have to choose between
Authentication is handled by SaToken 1.39.0, with sa-token-jwt and sa-token-redis-jackson alongside it. The README splits configuration into enabling authentication and authorization, then enabling JWT, and it asks you to confirm the authentication mode after integrating Redis. That last step matters: the template supports both a Redis-backed session mode and a JWT mode, and the README treats the choice as something the developer must make deliberately rather than a default that just works.
Caching is layered. Redis is the system cache, Redisson provides distributed locks and related structures, and Caffeine 3.1.8 is the local cache. The README claims multi-level caching is achievable, which is accurate in the sense that all three are wired in, but it does not document an eviction or invalidation strategy across the layers. If you build a two-level cache on top of this, coherence between Caffeine and Redis is your problem, not the template's.
Elasticsearch access goes through easy-es-boot-starter 2.0.0, described in the README as a framework that lets you operate Elasticsearch much like MyBatis-Plus operates MySQL. That is a real convenience, and it also means you are adopting a third abstraction over the official elasticsearch-rest-high-level-client 7.14.0 that sits underneath. Two layers of client abstraction over a search engine is a debugging cost when queries misbehave.
Spring AI integration and what the template does not settle for you
The template is on Spring AI 1.1.0 and includes three starters: spring-ai-openai-spring-boot-starter, spring-ai-zhipuai-spring-boot-starter and spring-ai-ollama-spring-boot-starter. That covers hosted OpenAI models, Zhipu AI, and local models through Ollama. The Ollama topic in the repository metadata lines up with the local-model path.
What the README does not provide is a decision framework for which one to use, prompt management, or any evaluation of output quality. The integration is a wiring exercise: the dependency is present, a starter is configured, and a model is reachable. Everything above that layer, including token accounting, retries and fallback between providers, is left to you.
There is a version-coupling risk here that is easy to miss. Spring AI 1.1.0 is a fast-moving project, and this template pins it inside a larger pom that also pins Spring Boot 3.2.5. Upgrading Spring AI independently of the rest of the stack is not something the README describes a procedure for.
Where the template gets in the way
The dependency list is the main limitation. Undertow replaces Tomcat, Druid is the connection pool, ShardingSphere 5.5.0 sits in the data layer, Hutool and a long list of Apache Commons libraries are present, and fastjson2 2.0.53 is included alongside Jackson. A new project rarely needs all of that. Removing a piece is not always a one-line pom edit, because the README's feature list (annotation-based idempotency, rate limiting, request encryption, logging) is built on top of the same infrastructure.
Elasticsearch 7.14.0 being mandatory is the sharpest constraint. If your team has standardized on Elasticsearch 8.x, or does not want a search cluster for a small service, this template's default configuration does not fit. The README states 7.X.X as mandatory and 7.14.0 as particularly recommended, and the bundled client is elasticsearch-rest-high-level-client 7.14.0, which is a major-version-locked pairing.
Maintenance is a real consideration. The last push to the repository was on 2026-05-12. The most recent releases listed are v2.2.0-jdk17 and v2.2.0-jdk11 from 2024-10-15. The README itself warns that branches are preview branches and that the README is not always current, which means the distance between what you read and what you get depends on which ref you pull. The README states the project is continuously updated by the author, but the release cadence visible in the repository is slower than that phrasing suggests.
The alternative: Spring Initializr plus the starters you actually need
The obvious comparison is Spring Initializr, the generator at start.spring.io. The difference is philosophical rather than technical. Initializr produces a minimal project with the dependencies you tick, and nothing else: no MyBatis-Plus, no SaToken, no object storage, no example business code. You then add starters yourself as requirements appear.
This template inverts that. It starts from a complete stack and asks you to subtract. For a team that already knows it needs Redis, a relational database, object storage and authentication, the template saves the assembly. For a team that is unsure, it imports a large surface area, and every dependency in the pom is a version you now track. The README's own framing supports this: it describes the goal as letting people quickly develop their own project on this basis, which presumes you want most of what is included.
A second alternative is to use Initializr for the skeleton and copy specific pieces out of this repository, such as the annotation-based idempotency or the offline IP lookup built on ip2region 2.7.0. That gets you the useful parts without the full dependency tree, at the cost of picking through the code yourself.
Licence and the cost of staying current
The repository is Apache-2.0. That permits commercial use and modification, and it requires that you retain the licence and attribution notices for the parts you keep. The README carries an attribution block naming AntonyCheng as author. If you fork the template into a product, keep the LICENSE file and the notices. This is a description of the licence terms, not legal advice; check the terms yourself for your situation.
The upgrade cost is the part that does not show up until later. Because the template pins Spring Boot 3.2.5, Spring AI 1.1.0, ShardingSphere 5.5.0, SaToken 1.39.0 and Elasticsearch 7.14.0 together, moving any one of them means testing the interactions. The README's advice to take stable versions from Releases rather than branches is the practical mitigation: you get a documented, coherent set of versions, and you give up the newest commits. Budget for a version bump as a project, not as a routine dependency update.
Editorial conclusion
Adopt it if you are starting a new Java web backend and want the integration work already done, and if you accept that you inherit every framework in the pom. Do not adopt it if you need a minimal dependency tree, or if you cannot run MySQL 8, Redis 7 and Elasticsearch 7.14.0. Before committing, run sql/init_db.sql, sql/init_xxl_job.sql and sql/init_power_job.sql, then read application-xxx.yaml to see which modules are actually enabled, because the README lists many features as optional.
Frequently asked questions
What is Spring Initializr used for?
Spring Initializr generates a minimal Spring Boot project from the dependencies you select. This template is a different approach: it ships a preassembled stack including MyBatis-Plus, SaToken, Redis, RabbitMQ and Elasticsearch, so you remove what you do not need instead of adding what you do.
What is Spring Boot and what is it used for?
Spring Boot is the framework this template is built on, at version 3.2.5 with Java 17. The template uses it to host a web application with Spring MVC, an Undertow servlet container, and the integration modules described in the README.
What is RestTemplate used for?
The README does not mention RestTemplate. The template lists okhttp 4.12.0 and okio 3.9.0 among its utility dependencies, so outbound HTTP calls in the example code are not documented as going through RestTemplate.
Community notes