Spring 文档暗示 @EnableRetry 和 @Retryable 与 spring 的 feign 客户端一起使用。但好像不是

问题描述 投票:0回答:1

在 spring 文档here中,建议添加 Spring Retry 作为依赖项,这样我们就可以在 Spring Feign 客户端上启用它。

但是,当我尝试以下代码时:

@Component
@FeignClient(value = "myFeign", url = "${my.url}")
public interface ingestionInterface{
    @Retryable(
            value = {FeignException.class},
            backoff = @Backoff(delay=50000)
    )
    @RequestMapping(
            produces = "application/json",
            method = RequestMethod.POST)
    Optional<ResponseEntity<Response>> postRequest(@Valid @RequestBody Request request);
}

我的应用程序无法编译,并出现错误:

Bean named 'blah.blah.ingestionInterface' is expected to be of type 'blah.blah.ingestionInterface' but was actually of type 'com.sun.proxy.$Proxy143'

如果这不是 Spring Retry 与 Spring Feign 的结合使用方式,那它又该如何使用呢?

java spring spring-boot spring-cloud-feign spring-retry
1个回答
0
投票

也许这篇文章可以帮助你。有一些自定义工作,但它可以解决代理问题

© www.soinside.com 2019 - 2024. All rights reserved.