我想直接在假装防御中定义我的后备功能,如Spring文档中所述,请参阅下面的代码,但是我得到一个错误,我无法定义静态类"modifier static not allowed here".当假装呼叫失败时,如何让后备功能运行?
问候,
Nadav
@FeignClient(name = "hello", fallback = HystrixClientFallback.class)
protected interface HystrixClient {
@RequestMapping(method = RequestMethod.GET, value = "/hello")
Hello iFailSometimes();
}
static class HystrixClientFallback implements HystrixClient {
@Override
public Hello iFailSometimes() {
return new Hello("fallback");
}
}
Run Code Online (Sandbox Code Playgroud)