-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
Same issue as #3415 but for SpringAiRetryAutoConfiguration
Problem
Code breaks when users upgrade to Spring 7 because the deprecated handleError(ClientHttpResponse) method gets completely removed.
Current code:
@Override
public void handleError(@NonNull ClientHttpResponse response) throws IOException {
// our error handling logic
}What changed:
Spring 6.2.x: Has both handleError(response) and handleError(url, method, response)
Spring 7.x: Removes the deprecated handleError(response) method entirely
Solution
Implement both methods, but don't use @Override on the old one:
@Override
public void handleError(URI url, HttpMethod method, @NonNull ClientHttpResponse response) throws IOException {
handleError(response); // delegate to existing logic
}
// No @Override annotation - works in both versions
public void handleError(@NonNull ClientHttpResponse response) throws IOException {
// existing error handling logic stays here
}How it works:
- When using Spring 6.2.x, we call the old method directly (no overhead)
- When using Spring 7.x, we call the new method, which delegates to our logic
- Same behavior, works with both versions