Using @Retryable in methods define in spring bean's base class are not retried

后端 未结 1 1493
孤城傲影
孤城傲影 2020-12-11 11:10

I have a spring managed bean of type B. I have @EnableREtry in a @Configuration class. When I use @Retryable on doStuff(), the method gets retried on failure as

相关标签:
1条回答
  • 2020-12-11 11:23

    @Retryable is implemented using Spring AOP.

    Only external calls to retryable methods go through the proxy (which invokes the method within a RetryTemplate); internal calls within the class bypass the proxy and therefore are not retried.

    You can play some tricks to get a reference to the proxy from the application context and call that, or simply use a RetryTemplate directly within your doStuff() method.

    0 讨论(0)
提交回复
热议问题