解决spring-test中Feign问题: No qualifying bean of type 'org.springframework.cloud.openfeign.FeignContext'...

问题现象:

      启动测试类(含通过Feign远程调用的组件),报错: No qualifying bean of type 'org.springframework.cloud.openfeign.FeignContext' available

问题解决:

      在测试类上加上如下代码:

import org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.ribbon.FeignRibbonClientAutoConfiguration;

@ImportAutoConfiguration({RibbonAutoConfiguration.class, FeignRibbonClientAutoConfiguration.class, FeignAutoConfiguration.class})

 

 

转载于:https://www.cnblogs.com/vae860514/p/11059384.html

你可能感兴趣的:(解决spring-test中Feign问题: No qualifying bean of type 'org.springframework.cloud.openfeign.FeignContext'...)