我对spring云网关hystrix的配置如下:
default-filters:
- name: Hystrix
args:
name: defaultGatewayCommand
fallbackUri: forward:/hystrix-fallback例如,当我在我的项目中抛出ResponseStatusException异常时,就会触发hystrix回退。
@GetMapping("/hystrix-fallback")
public Mono<ApiErrorResponse> hystrixFallback() {
return Mono.just(new ApiErrorResponse("xxxxxxxx"));
}我想捕获一些错误信息并构建我的新ApiErrorResponse,但我不知道该如何做?
发布于 2020-04-24 14:01:08
@ exchange.getAttribute(ServerWebExchangeUtils.HYSTRIX_EXECUTION_EXCEPTION_ATTR);(“/hystrix-hystrixFallback”)公有单色回落(ServerWebExchange交换){异常异常= return返回Mono.just(新ApiErrorResponse("xxxxxxxx"));}
https://stackoverflow.com/questions/51648850
复制相似问题