Align default order between @EnableAsync and @EnableResilientMethods

Retries async methods with Future return types in non-reactive path.

Closes gh-35643
This commit is contained in:
Juergen Hoeller
2025-10-15 13:52:44 +02:00
parent f15c12a190
commit 7dc78a4318
3 changed files with 47 additions and 9 deletions
@@ -60,10 +60,10 @@ public @interface EnableResilientMethods {
/**
* Indicate the order in which the {@link RetryAnnotationBeanPostProcessor}
* and {@link ConcurrencyLimitBeanPostProcessor} should be applied.
* <p>The default is {@link Ordered#LOWEST_PRECEDENCE} in order to run
* after all other post-processors, so that they can add advisors to
* existing proxies rather than double-proxy.
* <p>The default is {@link Ordered#LOWEST_PRECEDENCE - 1} in order to run
* after all common post-processors, except for {@code @EnableAsync}.
* @see org.springframework.scheduling.annotation.EnableAsync#order()
*/
int order() default Ordered.LOWEST_PRECEDENCE;
int order() default Ordered.LOWEST_PRECEDENCE - 1;
}
@@ -17,6 +17,7 @@
package org.springframework.resilience.retry;
import java.lang.reflect.Method;
import java.util.concurrent.Future;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
@@ -77,7 +78,7 @@ public abstract class AbstractRetryInterceptor implements MethodInterceptor {
return invocation.proceed();
}
if (this.reactiveAdapterRegistry != null) {
if (this.reactiveAdapterRegistry != null && !Future.class.isAssignableFrom(method.getReturnType())) {
ReactiveAdapter adapter = this.reactiveAdapterRegistry.getAdapter(method.getReturnType());
if (adapter != null) {
Object result = invocation.proceed();