You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by evgenvi April 20, 2022
The evaluationContext is passed when parsing all the expression parameters of Retryable and Backoff annotations except for CircuitBreaker annotation in AnnotationAwareRetryOperationsInterceptor.
For example, it's passed when parsing delayExpression parameter: PARSER.parseExpression(resolve(delayExpression),PARSER_CONTEXT) .getValue(this.evaluationContext, Long.class);
For example, it isn't passed when parsing openTimeoutExpression parameter: PARSER.parseExpression(resolve(circuit.openTimeoutExpression()), PARSER_CONTEXT) .getValue(Long.class);
if we try to resolve this snippet of code:
public static class Configs {
public int maxAttempts = 10;
public long openTimeout = 10000;
public long resetTimeout = 10000;
}
@Bean
public Configs configs() {
return new Configs();
}
@Component
public static class Service {
@CircuitBreaker(
maxAttemptsExpression = "#{@configs.maxAttempts}",
openTimeoutExpression = "#{@configs.openTimeout}",
resetTimeoutExpression = "#{@configs.resetTimeout}"
)
public String method() {
return "value";
}
}
The only maxAttempts parameter will be resolved correctly and we will get an exception for the other two parameters org.springframework.expression.spel.SpelEvaluationException: EL1057E: No bean resolver registered in the context to resolve access to bean 'configs'
@garyrussell could you tell me if there is any reason why the evaluation context isn't passed when parsing expressions for CircuitBreaker properties?
The text was updated successfully, but these errors were encountered:
I guess they have to be simplified: maxAttemptsExpression = "configs.maxAttempts" since we really talk about expressions and their ability to be resolved against beans.
garyrussell
added a commit
to garyrussell/spring-retry
that referenced
this issue
Apr 20, 2022
Discussed in #291
Originally posted by evgenvi April 20, 2022
The evaluationContext is passed when parsing all the expression parameters of
Retryable
andBackoff
annotations except forCircuitBreaker
annotation inAnnotationAwareRetryOperationsInterceptor
.For example, it's passed when parsing delayExpression parameter:
PARSER.parseExpression(resolve(delayExpression),PARSER_CONTEXT) .getValue(this.evaluationContext, Long.class);
For example, it isn't passed when parsing openTimeoutExpression parameter:
PARSER.parseExpression(resolve(circuit.openTimeoutExpression()), PARSER_CONTEXT) .getValue(Long.class);
if we try to resolve this snippet of code:
public static class Configs {
public int maxAttempts = 10;
public long openTimeout = 10000;
public long resetTimeout = 10000;
}
The only
maxAttempts
parameter will be resolved correctly and we will get an exception for the other two parametersorg.springframework.expression.spel.SpelEvaluationException: EL1057E: No bean resolver registered in the context to resolve access to bean 'configs'
@garyrussell could you tell me if there is any reason why the evaluation context isn't passed when parsing expressions for CircuitBreaker properties?
The text was updated successfully, but these errors were encountered: