How can I make spring @retryable configurable?

后端 未结 5 1722
误落风尘
误落风尘 2021-02-13 05:46

I have this piece of code

@Retryable(maxAttempts = 3, stateful = true, include = ServiceUnavailableException.class,
        exclude = URISyntaxException.class, b         


        
5条回答
  •  悲&欢浪女
    2021-02-13 06:03

    If you want to supply a default, and then optionally override it in your application.properties file:

    @Retryable(maxAttemptsExpression = "#{${my.max.attempts:10}}")
    public void myRetryableMethod() {
        // ...
    }
    

提交回复
热议问题