我有
@FeignClient(name="verbservice", fallback = VerbClientFallback.class)
public interface VerbClient {
@GetMapping
public String getVerbWord();
}
和
@Component
public class VerbClientFallback implements VerbClient {
@Override
public String getVerbWord() {
return "fallback";
}
}
应用
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@EnableHystrix
public class SentenceAppApplication {
...}
控制器
@Autowired
private VerbClient verbClient;
....
return verbClient.getVerbWord() + ....other;
application.properties
feign.hystrix.enabled=true
版本Spring boot 2.5.4
<properties>
<java.version>11</java.version>
<spring-cloud.version>2020.0.3</spring-cloud.version>
</properties>
目标:停止动词服务并查看是否调用了回退
问题:
嵌套异常是伪造的。RetryableException: Connection refused: no使用根本原因
执行GET http://verbservice]的详细信息
我尝试了这个链接中的步骤…但这并没有奏效假装Hystrix回退不工作
似乎属性
feign.hystrix.enabled = true
改为
feign.circuitbreaker.enabled = true