Currently, implementing a RetryListener requires manually configuring a RetryTemplate. This forces developers to abandon the declarative @Retryable annotation and write programmatic boilerplate code to handle retry lifecycle events (logging, metrics, etc.), which was previously easier to manage via @Recover.
Add a listener attribute to the @Retryable annotation to allow declarative registration of a RetryListener bean.
@Retryable(listener = MyListener.class)
public void execute() {}
@Component // optional maybe?
class MyListener implements RetryListener{}
Currently, implementing a
RetryListenerrequires manually configuring aRetryTemplate. This forces developers to abandon the declarative@Retryableannotation and write programmatic boilerplate code to handle retry lifecycle events (logging, metrics, etc.), which was previously easier to manage via@Recover.Add a listener attribute to the
@Retryableannotation to allow declarative registration of aRetryListenerbean.