我已参考此wiki页为Feign Client定义了自定义ErrorDecoder
。
在我的ErrorDecoder
中,我正在通过调用response.body()
阅读close
时,我是否需要ErrorDecoder
在我的InputStream
中做出回应。还是Feign将处理response
的结案?
我检查了SynchronousMethodHandler
,它调用了自定义错误解码器。这具有finally
块
} finally {
if (shouldClose) {
Util.ensureClosed(response.body());
}
因为Wiki页面上没有准则。
答案 0 :(得分:0)
如果您直接阅读Response
对象,您必须自己关闭身体,我们将泄漏资源。如果您返回Response
对象作为Feign接口的一部分,则也是如此。