优化版本检查器校验不通过时的提示语

This commit is contained in:
click33
2024-04-01 06:18:41 +08:00
parent 3ce3160f05
commit e2603295c7
3 changed files with 22 additions and 3 deletions

View File

@@ -1,8 +1,15 @@
package cn.dev33.satoken.reactor.spring;
import cn.dev33.satoken.exception.SaTokenException;
import cn.dev33.satoken.util.SaFoxUtil;
import org.springframework.boot.SpringBootVersion;
/**
* SpringBoot 版本与 Sa-Token 版本兼容检查器
*
* @author Uncarbon
* @since 1.38.0
*/
public class SpringBootVersionCompatibilityChecker {
public SpringBootVersionCompatibilityChecker() {
@@ -10,6 +17,9 @@ public class SpringBootVersionCompatibilityChecker {
if (SaFoxUtil.isEmpty(version) || version.startsWith("1.") || version.startsWith("2.")) {
return;
}
throw new BootstrapMethodError("当前Spring-Boot版本" + version + "请尝试改用sa-token-reactor-spring-boot3-starter");
String str = "当前 SpringBoot 版本" + version + ")与 Sa-Token 依赖不兼容," +
"请将依赖 sa-token-reactor-spring-boot-starter 修改为sa-token-reactor-spring-boot3-starter";
System.err.println(str);
throw new SaTokenException(str);
}
}