dromara/Sa-Token · error · SaTokenException

当前 SpringBoot 版本(" + version + ")与 Sa-Token 依赖不兼容,请将依赖 sa-to

Error message

当前 SpringBoot 版本(" + version + ")与 Sa-Token 依赖不兼容,请将依赖 sa-token-reactor-spring-boot-starter 修改为:sa-token-reactor-spring-boot3/4-starter

What it means

Error "当前 SpringBoot 版本(" + version + ")与 Sa-Token 依赖不兼容,请将依赖 sa-token-reactor-spring-boot-starter 修改为:sa-token-reactor-spring-boot3/4-starter" thrown in dromara/Sa-Token.

Source

Thrown at sa-token-starter/sa-token-reactor-spring-boot-starter/src/main/java/cn/dev33/satoken/reactor/spring/SpringBootVersionCompatibilityChecker.java:23

import org.springframework.boot.SpringBootVersion;

/**
 * SpringBoot 版本与 Sa-Token 版本兼容检查器,当开发者错误的在 SpringBoot3/4.x 项目中引入当前集成包时,将在控制台做出提醒并阻断项目启动
 *
 * @author Uncarbon
 * @since 1.38.0
 */
public class SpringBootVersionCompatibilityChecker {

    public SpringBootVersionCompatibilityChecker() {
        String version = SpringBootVersion.getVersion();
        if (SaFoxUtil.isEmpty(version) || version.startsWith("1.") || version.startsWith("2.")) {
            return;
        }
        String str = "当前 SpringBoot 版本(" + version + ")与 Sa-Token 依赖不兼容," +
                "请将依赖 sa-token-reactor-spring-boot-starter 修改为:sa-token-reactor-spring-boot3/4-starter";
        System.err.println(str);
        throw new SaTokenException(str);
    }

}

View on GitHub (pinned to ac2c7f6e94)

Solutions

  1. 当前项目运行在 SpringBoot 3.x/4.x,却引入了面向 SpringBoot 2.x 的 sa-token-reactor-spring-boot-starter。将 Maven/Gradle 依赖改为 sa-token-reactor-spring-boot3-starter(SpringBoot 3.x)或 sa-token-reactor-spring-boot4-starter(SpringBoot 4.x)。
  2. 修改依赖后执行 mvn clean 或 gradle clean build,清除旧依赖缓存后重新启动项目。

When it happens

Trigger: Thrown at sa-token-starter/sa-token-reactor-spring-boot-starter/src/main/java/cn/dev33/satoken/reactor/spring/SpringBootVersionCompatibilityChecker.java:23 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dromara/Sa-Token@ac2c7f6e94 (2026-08-14). Data as JSON: /api/errors/dfd3fab555439949. Report an issue: GitHub.