无法注入虚假客户端接口依赖项

我正在使用伪装客户端连接服务,但是当我尝试注入接口的依赖项时却出现错误消息。

目前,我正在做以下事情:-

1。使用Feign Client的自定义界面

@FeignClient(name="currency-exchange-service",url="localhost:8000")
public interface CurrencyExchangeServiceProxy {

    @GetMapping("/currency-exchange/from/{from}/to/{to}")
    public CurrencyConversionBean retrieveExchangeValue
        (@PathVariable("from") String from,@PathVariable("to") String to); 

}

2。配置类

@SpringBootApplication
@EnableFeignClients("com.learning.microservices.currencyconversionservice")
public class CurrencyConversionServiceApplication {

    public static void main(String[] args) {        
       SpringApplication.run(CurrencyConversionServiceApplication.class,args);
    }

}

3。在控制器中注入Feign客户端接口(CurrencyExchangeServiceProxy

@RestController
public class CurrencyConversionController {

    @Autowired
    private CurrencyExchangeServiceProxy proxy;

        ........
}

我遇到错误

Field proxy in com.learning.microservices.currencyconversionservice.CurrencyConversionController required a bean of type 'com.learning.microservices.currencyconversionservice.CurrencyExchangeServiceProxy' that could not be found.

The injection point has the following annotations:  - 

@org.springframework.beans.factory.annotation.Autowired(required=true)
kabenxiagu 回答:无法注入虚假客户端接口依赖项

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

大家都在问