【发布时间】:2019-04-15 05:24:16
【问题描述】:
我们正在为 REST API 使用 Zuul、Eureka 和 Spring Boot 应用程序服务。
假设我的 spring boot 服务已关闭,当我尝试使用 Zuul API 网关访问 API 时,我收到 ZuulException 并且响应如下:
{
"timestamp": "2018-10-12T14:29:09.632+0000",
"status": 500,
"error": "Internal Server Error",
"exception": "com.netflix.zuul.exception.ZuulException",
"message": "GENERAL"
}
我想自定义响应格式如下:
{
"success": false,
"message": "Service is down. Please try later"
}
我尝试实现https://stackoverflow.com/a/39841785/5506061,但它对我不起作用。
请建议如何自定义 ZuulException 的响应。
【问题讨论】: