Skip to content

Add listener attribute to @Retryable #37092

Description

@muchiri08

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{}

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions