How can I make spring @retryable configurable?

后端 未结 5 1719
误落风尘
误落风尘 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:10

    It's not currently possible; to wire in properties, the annotation would have to be changed to take String values and the annotation bean post-processor would have to resolve placeholders and/or SpEL expressions.

    See this answer for an alternative, but it can't currently be done via the annotation.

    EDIT

    
        
            
                
                    
                        
                    
                
                
                    
                        
                        
                    
                
            
        
    
    
    
        
        
    
    

    Where EchoService.test is the method you want to apply retries to.

提交回复
热议问题