Closed
Description
@retryable doesnt seem to evaluate maxAttemptsExpression while creating the retryTemplate, if it has an exceptionExpression
This piece of code in AnnotationAwareRetryOperationsInterceptor.java should be modified i guess .
if (simple == null) {
if (hasExpression) {
simple = new ExpressionRetryPolicy(maxAttempts, policyMap, true, resolve(exceptionExpression),
retryNotExcluded)
.withBeanFactory(this.beanFactory);
}
else {
simple = new SimpleRetryPolicy(maxAttempts, policyMap, true, retryNotExcluded);
if (expression != null) {
simple.maxAttemptsSupplier(() -> evaluate(expression, Integer.class, stateless));
}
}
}
The maxAttempts supplies should be evaluated no matter , exceptionExpression is present or not.
This should be like this maybe
if (simple == null) {
if (hasExpression) {
simple = new ExpressionRetryPolicy(maxAttempts, policyMap, true, resolve(exceptionExpression),
retryNotExcluded)
.withBeanFactory(this.beanFactory);
}
else {
simple = new SimpleRetryPolicy(maxAttempts, policyMap, true, retryNotExcluded);
}
if (expression != null) {
simple.maxAttemptsSupplier(() -> evaluate(expression, Integer.class, stateless));
}
}