mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-10-22 03:27:23 +08:00
feat: Spring Boot3.x错误地使用sa-token-*spring-boot-starter时,将阻断程序启动
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package cn.dev33.satoken.spring;
|
||||
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
import org.springframework.boot.SpringBootVersion;
|
||||
|
||||
public class SpringBootVersionCompatibilityChecker {
|
||||
|
||||
public SpringBootVersionCompatibilityChecker() {
|
||||
String version = SpringBootVersion.getVersion();
|
||||
if (SaFoxUtil.isEmpty(version)) {
|
||||
return;
|
||||
}
|
||||
if (version.startsWith("1.") || version.startsWith("2.")) {
|
||||
return;
|
||||
}
|
||||
BootstrapMethodError error = new BootstrapMethodError("当前Spring-Boot版本为" + version + ",请尝试改用:sa-token-spring-boot3-starter");
|
||||
error.fillInStackTrace();
|
||||
throw error;
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
cn.dev33.satoken.spring.SpringBootVersionCompatibilityChecker
|
Reference in New Issue
Block a user