我可以在同一方法上使用spring retryable和cacheable吗?

我在Spring Boot(2.1.6.RELEASE)应用程序中有一个Spring组件,

  

@EnableRetry   @EnableCaching

在主班上。我让下面的方法成功缓存,但是随后添加了Retry,并且不再缓存。

@Component
public class MyComponent {
    @Cacheable("namedCached")
    @Retryable(maxAttempts = 5,value = {IOException.class},backoff = @Backoff(delay = 2L))
    public List<RemoteObject> loadList(String code,String year) throws IOException {
        // throws IOException upon failure
    }
}

这里有无法解决的冲突吗?还是我需要将其拆分为两个@Components,其中一个将@Retryable放在另一个周围?

summerwind09 回答:我可以在同一方法上使用spring retryable和cacheable吗?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2890884.html

大家都在问