diff --git a/yudao-framework/yudao-spring-boot-starter-web/pom.xml b/yudao-framework/yudao-spring-boot-starter-web/pom.xml
index ac1ab3dfc..0943f9f5a 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/pom.xml
+++ b/yudao-framework/yudao-spring-boot-starter-web/pom.xml
@@ -61,7 +61,13 @@
true
-
+
+
+ com.google.guava
+ guava
+ provided
+
+
org.jsoup
jsoup
diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
index 627a5ea78..abab1ce51 100644
--- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
+++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
@@ -17,6 +17,7 @@ import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils;
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
+import com.google.common.util.concurrent.UncheckedExecutionException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.ConstraintViolationException;
@@ -111,6 +112,9 @@ public class GlobalExceptionHandler {
if (ex instanceof AccessDeniedException) {
return accessDeniedExceptionHandler(request, (AccessDeniedException) ex);
}
+ if (ex instanceof UncheckedExecutionException && ex.getCause() != ex) {
+ return allExceptionHandler(request, ex.getCause());
+ }
return defaultExceptionHandler(request, ex);
}
@@ -266,6 +270,16 @@ public class GlobalExceptionHandler {
return CommonResult.error(FORBIDDEN);
}
+ /**
+ * 处理 Guava UncheckedExecutionException
+ *
+ * 例如说,缓存加载报错,可见 https://t.zsxq.com/UszdH
+ */
+ @ExceptionHandler(value = UncheckedExecutionException.class)
+ public CommonResult> uncheckedExecutionExceptionHandler(HttpServletRequest req, UncheckedExecutionException ex) {
+ return allExceptionHandler(req, ex.getCause());
+ }
+
/**
* 处理业务异常 ServiceException
*
diff --git a/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.http b/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.http
index f42dfcd03..f21eb5268 100644
--- a/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.http
+++ b/yudao-module-system/yudao-module-system-server/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.http
@@ -21,6 +21,16 @@ tenant-id: {{adminTenantId}}
"password": "admin123"
}
+### 请求 /login 接口 => 失败(租户不存在)
+POST {{baseUrl}}/system/auth/login
+Content-Type: application/json
+tenant-id: 2
+
+{
+ "username": "admin",
+ "password": "admin123"
+}
+
### 请求 /get-permission-info 接口 => 成功
GET {{baseUrl}}/system/auth/get-permission-info
Authorization: Bearer {{token}}