当前位置: 首页 > 知识库问答 >
问题:

假重试:找不到能够从[java.lang.string]类型转换为[java.lang.class]类型的转换器

柯琛
2023-03-14

io.github.openfeign.feign-hystrix->v10.10.1

io.github.openfeign.feign-form->V3.8.0

Feign Retryer错误-找不到能够从[java.lang.String]类型转换为[java.lang.class ]类型的转换器

feign:
  client:
    config:
      default:
        connectTimeout: 60000000
        readTimeout: 60000000
      client-service:
        error-decoder: testservice.exception.FeignClientErrorDecoder
        retryer: testservice.exception.FeignClientRetryer
Property: feign.client.config.client-service.retryer
Value: testservice.exception.FeignClientRetryer
Origin: class path resource [application.yml]:56:18
Reason: No converter found capable of converting from type [java.lang.String] to type [java.lang.Class<feign.Retryer>]

更新应用程序的配置

向你致意,Manuag

共有1个答案

子车煌
2023-03-14

代码按原样运行的先决条件是:

  • FeignClientRetryer必须实现Feign.Retryer
  • FeignClientRetryer在类上必须有@component构造型。
  • @FeignClient应具有value=“client-service”

如果它仍然没有运行,那么您可以尝试以下操作:

public class ClientServiceFeignConfig{

    @Bean
    public Retryer clientServiceRetryer(){
        return new FeignClientRetryer();
    }
}
@FeignClient(value="client-service", configuration = ClientServiceFeignConfig.class)
 类似资料: