Spring Framework 7.0.0-M9
Spring Retry's RetryTemplateBuilder
has a traversingCauses()
option, allowing setups like this:
new RetryTemplateBuilder()
.retryOn(IOException.class)
.traversingCauses()
.build();
This is handy for scenarios where I don't really care about the top-level exception being thrown, but I want to retry if the underlying cause is an IOException
, for example.
The new support in Framework doesn't really have an equivalent here.
While I can supply my own exception predicate to the RetryPolicy
and check the root cause myself, I wouldn't be able to use the convenient includes()
and excludes()
configurations for that.
Please consider adding that feature, allowing me to do something like this:
new RetryTemplate(RetryPolicy.builder()
.includes(Foo.class)
.excludes(Bar.class)
.traversingCauses()
.build());
The annotation-based equivalent would be @Retryable(includes = Foo.class, excludes = Bar.class, traversingCauses = true)
.