优化:区分 HTTP 错误,返回明确原因 (#752)

* 优化:区分 HTTP 错误,返回明确原因

* 修复 缓存关闭共享的 client,会导致后续请求失败

* 修复 缓存关闭共享的 client,会导致后续请求失败

---------

Co-authored-by: 高雄 <admin@cxcp.com>
This commit is contained in:
gaoxingzaq
2026-05-09 15:04:25 +08:00
committed by GitHub
parent 4474ab1d57
commit 1f60e30f09
3 changed files with 113 additions and 23 deletions

View File

@@ -0,0 +1,14 @@
package cn.keking.utils;
import org.springframework.stereotype.Component;
import jakarta.annotation.PreDestroy;
@Component
public class HttpClientLifecycle {
@PreDestroy
public void destroy() {
System.out.println("Spring 容器关闭,释放 HTTP 连接池资源...");
HttpRequestUtils.shutdown();
}
}