0
當我研究與hystrix春假雲虛假,有一個問題,即 如果我使用LOGGER.info(「**** {}」,cause.getMessage()),後備不起作用,UserFeignClient#findById(長)超時和回退失敗。但是,如果我刪除cause.getMessage(),回退是可以的。爲什麼?春天雲hystrix fallbackfactory
public class UserFeignFallBackFactory implements FallbackFactory<UserFeignClient> {
private static final Logger LOGGER = LoggerFactory.getLogger(UserFeignFallBackFactory.class);
@Override
public UserFeignClient create(Throwable cause) {
LOGGER.info("call UserFeignClient error, error msg is : {}");
return new UserFeignClientEx() {
@Override
public User findById(@PathVariable("id") Long id) {
return new User(-1L, null, null, (short) 20);
}
};
}
}