From 7db504cbc6d08e50666c86a3dbd6c7da5147b630 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期六, 17 十月 2026 13:28:09 +0800
Subject: [PATCH] fix(web): 修复客户端断开连接时的异常处理
---
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
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 0eb7f5e..905697d 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.web.core.util.WebFrameworkUtils;
import com.google.common.util.concurrent.UncheckedExecutionException;
import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.ValidationException;
@@ -34,6 +35,7 @@
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.context.request.async.AsyncRequestNotUsableException;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.multipart.MaxUploadSizeExceededException;
import org.springframework.web.servlet.NoHandlerFoundException;
@@ -67,6 +69,14 @@
private final ApiErrorLogCommonApi apiErrorLogApi;
+ /** 瀹㈡埛绔凡鏂紑鏃跺搷搴斾笉鍙啀鍐欙紱娉ㄥ叆 HttpServletResponse 浣� Spring MVC 鐩存帴缁撴潫澶勭悊銆� */
+ @ExceptionHandler(AsyncRequestNotUsableException.class)
+ public void asyncRequestNotUsableExceptionHandler(HttpServletRequest request,
+ HttpServletResponse response,
+ AsyncRequestNotUsableException ex) {
+ log.debug("[asyncRequestNotUsableExceptionHandler][瀹㈡埛绔凡鏂紑 uri={}]", request.getRequestURI());
+ }
+
/**
* 澶勭悊鎵�鏈夊紓甯革紝涓昏鏄彁渚涚粰 Filter 浣跨敤
* 鍥犱负 Filter 涓嶈蛋 SpringMVC 鐨勬祦绋嬶紝浣嗘槸鎴戜滑鍙堥渶瑕佸厹搴曞鐞嗗紓甯革紝鎵�浠ヨ繖閲屾彁渚涗竴涓叏閲忕殑寮傚父澶勭悊杩囩▼锛屼繚鎸侀�昏緫缁熶竴銆�
--
Gitblit v1.9.3