From 1858306fdec94ac8c98a0eaf9e10bdbbc5417f51 Mon Sep 17 00:00:00 2001 From: click33 <2393584716@qq.com> Date: Sun, 8 Mar 2026 12:48:13 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=20SpringBoot4=20?= =?UTF-8?q?=E5=BC=95=E5=85=A5=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sa-token-doc/micro/gateway-auth.md | 7 +++++-- sa-token-doc/micro/import-intro.md | 14 ++++++++++---- sa-token-doc/micro/same-token.md | 14 ++++++++++---- sa-token-doc/more/common-questions.md | 9 +++++---- sa-token-doc/start/download.md | 10 ++++++++-- sa-token-doc/start/example.md | 10 ++++------ sa-token-doc/start/webflux-example.md | 9 ++++++--- 7 files changed, 48 insertions(+), 25 deletions(-) diff --git a/sa-token-doc/micro/gateway-auth.md b/sa-token-doc/micro/gateway-auth.md index 1ee62c14..b1cc90c2 100644 --- a/sa-token-doc/micro/gateway-auth.md +++ b/sa-token-doc/micro/gateway-auth.md @@ -16,7 +16,6 @@ -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` xml @@ -36,8 +35,10 @@ commons-pool2 ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 + -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` gradle // Sa-Token 权限认证(Reactor响应式集成),在线文档:https://sa-token.cc implementation 'cn.dev33:sa-token-reactor-spring-boot-starter:${sa.top.version}' @@ -46,6 +47,8 @@ implementation 'cn.dev33:sa-token-reactor-spring-boot-starter:${sa.top.version}' implementation 'cn.dev33:sa-token-redis-jackson:${sa.top.version}' implementation 'org.apache.commons:commons-pool2' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 diff --git a/sa-token-doc/micro/import-intro.md b/sa-token-doc/micro/import-intro.md index 6c3774a8..9f650ce1 100644 --- a/sa-token-doc/micro/import-intro.md +++ b/sa-token-doc/micro/import-intro.md @@ -12,7 +12,6 @@ -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-spring-boot-starter` 修改为 `sa-token-spring-boot3-starter` 即可。 ``` xml @@ -21,17 +20,20 @@ ${sa.top.version} ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 + -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-spring-boot-starter` 修改为 `sa-token-spring-boot3-starter` 即可。 ``` gradle // Sa-Token 权限认证,在线文档:https://sa-token.cc implementation 'cn.dev33:sa-token-spring-boot-starter:${sa.top.version}' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` xml @@ -40,12 +42,16 @@ implementation 'cn.dev33:sa-token-spring-boot-starter:${sa.top.version}' ${sa.top.version} ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 + -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` gradle // Sa-Token 权限认证(Reactor响应式集成),在线文档:https://sa-token.cc implementation 'cn.dev33:sa-token-reactor-spring-boot-starter:${sa.top.version}' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 diff --git a/sa-token-doc/micro/same-token.md b/sa-token-doc/micro/same-token.md index 20a71076..98805776 100644 --- a/sa-token-doc/micro/same-token.md +++ b/sa-token-doc/micro/same-token.md @@ -28,7 +28,6 @@ Sa-Token提供两种解决方案: 在网关处引入的依赖为(此处以 SpringCloud Gateway 为例): -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` xml @@ -48,8 +47,10 @@ Sa-Token提供两种解决方案: commons-pool2 ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 + -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` gradle // Sa-Token 权限认证(Reactor响应式集成),在线文档:https://sa-token.cc implementation 'cn.dev33:sa-token-reactor-spring-boot-starter:${sa.top.version}' @@ -58,12 +59,13 @@ implementation 'cn.dev33:sa-token-reactor-spring-boot-starter:${sa.top.version}' implementation 'cn.dev33:sa-token-redis-jackson:${sa.top.version}' implementation 'org.apache.commons:commons-pool2' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 在下游子服务引入的依赖为: -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-spring-boot-starter` 修改为 `sa-token-spring-boot3-starter` 即可。 ``` xml @@ -83,8 +85,10 @@ implementation 'org.apache.commons:commons-pool2' commons-pool2 ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 + -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-spring-boot-starter` 修改为 `sa-token-spring-boot3-starter` 即可。 ``` gradle // Sa-Token 权限认证,在线文档:https://sa-token.cc implementation 'cn.dev33:sa-token-spring-boot-starter:${sa.top.version}' @@ -93,6 +97,8 @@ implementation 'cn.dev33:sa-token-spring-boot-starter:${sa.top.version}' implementation 'cn.dev33:sa-token-redis-jackson:${sa.top.version}' implementation 'org.apache.commons:commons-pool2' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 ##### 2、网关处添加Same-Token diff --git a/sa-token-doc/more/common-questions.md b/sa-token-doc/more/common-questions.md index d00ece35..890d5678 100644 --- a/sa-token-doc/more/common-questions.md +++ b/sa-token-doc/more/common-questions.md @@ -625,9 +625,10 @@ Sa-Token 的部分 API 只能在 Web 上下文中才能调用,例如:`StpUti 在 sa-token-core 核心包中,Sa-Token 底层不能确认最终运行的 web 容器,所以抽象了 `SaTokenContext` 接口,对接不同容器时需要注入不同的实现, 通常这个注入工作都是框架自动完成的,你只需要按照文档开始部分集成相应的依赖即可。例如: -- 你要在 Springboot2.x 中使用 Sa-Token,就引入:`sa-token-spring-boot-starter`。 -- 你要在 Springboot3.x 中使用 Sa-Token,就引入:`sa-token-spring-boot3-starter`。 -- 你要在基于 webflux 架构的网关中使用 Sa-Token,就引入:`sa-token-reactor-spring-boot-starter`。 +- 如果你使用的 `SpringBoot 2.x`,请引入 `sa-token-spring-boot-starter`。 +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 +- 如果你在基于 WebFlux 架构的网关中使用 Sa-Token,请引入 `sa-token-reactor-spring-boot-starter`(3.x 用 `sa-token-reactor-spring-boot3-starter`,4.x 用 `sa-token-reactor-spring-boot4-starter`)。 - 你要在 Solon 中使用 Sa-Token,就引入:`sa-token-solon-plugin`。 - 等等等等…… @@ -642,7 +643,7 @@ Sa-Token 的部分 API 只能在 Web 上下文中才能调用,例如:`StpUti - 如果引入了 `spring-boot-starter-webflux` 就是WebFlux环境。 - 什么?你说你两个都引入了?那你的项目能启动成功吗? 4. 如果是 WebFlux 环境而且正确引入了依赖,依然报错,**请检查是否注册了 SaReactorFilter 全局过滤器,在 WebFlux 下这一步是必须的**,具体还是请参考上面的 [ 在WebFlux环境集成 ] 章节。 -5. 需要仔细注意,如果你使用的是 Springboot3.x 版本,就不要错误的引入 `sa-token-spring-boot-starter`,需要引入的是 `sa-token-spring-boot3-starter`,不然就会导致框架报错。 +5. 需要仔细注意,如果你使用的是 `SpringBoot 3.x` 或 `SpringBoot 4.x`,请分别引入 `sa-token-spring-boot3-starter` 或 `sa-token-spring-boot4-starter`,不要错误引入 `sa-token-spring-boot-starter`,不然会导致框架报错。 6. 如果你的项目开启了全局懒加载(spring.main.lazy-initialization=true)后,能启动项目,但是访问接口报异常,请直接参考:[Q:开启了全局懒加载后,能启动项目,但是访问接口报未能获取有效的上下文处理器](/more/common-questions?id=q:开启了全局懒加载后,能启动项目,但是访问接口报未能获取有效的上下文处理器) 7. 如果以上步骤排除无误后依然报错,请直接提 issue 或者加入QQ群求助。 diff --git a/sa-token-doc/start/download.md b/sa-token-doc/start/download.md index 69c72e30..ec880369 100644 --- a/sa-token-doc/start/download.md +++ b/sa-token-doc/start/download.md @@ -19,7 +19,8 @@ ${sa.top.version} ``` -注:如果你使用的 `SpringBoot 3.x`,只需要将 `sa-token-spring-boot-starter` 修改为 `sa-token-spring-boot3-starter` 即可。 +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 注:如果你使用的框架基于 Reactor 模型构建(WebFlux、SpringCloud Gateway 等),请引入此包 @@ -31,7 +32,8 @@ ${sa.top.version} ``` -注:如果你使用的 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 参考:[Solon官网](https://solon.noear.org/) @@ -121,11 +123,15 @@ ``` gradle implementation 'cn.dev33:sa-token-spring-boot-starter:${sa.top.version}' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 ``` gradle implementation 'cn.dev33:sa-token-reactor-spring-boot-starter:${sa.top.version}' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 ``` gradle diff --git a/sa-token-doc/start/example.md b/sa-token-doc/start/example.md index 88da70ec..e23e19c4 100644 --- a/sa-token-doc/start/example.md +++ b/sa-token-doc/start/example.md @@ -15,9 +15,6 @@ - -注:如果你使用的是 SpringBoot 3.x,只需要将 `sa-token-spring-boot-starter` 修改为 `sa-token-spring-boot3-starter` 即可。 - ``` xml @@ -26,15 +23,16 @@ ${sa.top.version} ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 - -注:如果你使用的是 SpringBoot 3.x,只需要将 `sa-token-spring-boot-starter` 修改为 `sa-token-spring-boot3-starter` 即可。 - ``` gradle // Sa-Token 权限认证,在线文档:https://sa-token.cc implementation 'cn.dev33:sa-token-spring-boot-starter:${sa.top.version}' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-spring-boot4-starter`。 diff --git a/sa-token-doc/start/webflux-example.md b/sa-token-doc/start/webflux-example.md index 8799fe5b..2e8d3a35 100644 --- a/sa-token-doc/start/webflux-example.md +++ b/sa-token-doc/start/webflux-example.md @@ -21,7 +21,6 @@ -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` xml @@ -30,20 +29,24 @@ ${sa.top.version} ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` gradle // Sa-Token 权限认证(Reactor响应式集成),在线文档:https://sa-token.cc implementation 'cn.dev33:sa-token-reactor-spring-boot-starter:${sa.top.version}' ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。 -注:如果你使用的是 `SpringBoot 3.x`,只需要将 `sa-token-reactor-spring-boot-starter` 修改为 `sa-token-reactor-spring-boot3-starter` 即可。 ``` gradle // Sa-Token 权限认证(Reactor响应式集成),在线文档:https://sa-token.cc implementation("cn.dev33:sa-token-reactor-spring-boot-starter:${sa.top.version}") ``` +- 如果你使用的 `SpringBoot 3.x`,请引入 `sa-token-reactor-spring-boot3-starter`。 +- 如果你使用的 `SpringBoot 4.x`,请引入 `sa-token-reactor-spring-boot4-starter`。