我有下面的FeignClient:
@FeignClient(name="FooMS",fallback=CustomerFeign.CustomerFeignImpl.class)
public interface CustomerFeign {
@RequestMapping(value="/bar/{phoneNo}")
List<Long> getFriends(@PathVariable("phoneNo") Long phoneNo);
class CustomerFeignImpl implements CustomerFeign{
@Override
public List<Long> getFriends(Long phoneNo) {
return new ArrayList<Long>(108);
}
}
}
当FooMS实例关闭时,我得到500错误而不是正在执行的回退。为什么会这样?
答案 0 :(得分:2)
将您的CustomerFeignImpl
标记为@Component
或从中创建@Bean
。
答案 1 :(得分:0)
添加@Component和feign.hystrix.enabled = true很好