我对Feign客户端有疑问。我有三个模块使用假装相互通信。它看起来像这样:
moduleA< --- feign ---> moduleB< ---- feign ----> moduleC
当 moduleC 向 moduleB 发送成功回复时,我的问题就出现了。我对假装核心课程进行了分析并找到了原因。
package feign;
public final class Response {
private final int status;
private final String reason;
private final Map<String, Collection<String>> headers;
private final Body body;
private Response(int status, String reason, Map<String, Collection<String>> headers, Body body) {
checkState(status >= 200, "Invalid status code: %s", status); //my status is 200
this.status = status;
this.reason = checkNotNull(reason, "reason"); // my reason is unfortunatelly null
LinkedHashMap<String, Collection<String>>
copyOf =
new LinkedHashMap<String, Collection<String>>();
copyOf.putAll(checkNotNull(headers, "headers"));
this.headers = Collections.unmodifiableMap(copyOf);
this.body = body; //nullable
}
}
在feign-core类中,当方法checkNotNull(reason,&#34; reason&#34;)被触发时,即使响应状态为200,也会出现NullPointerException。如何修复它?
编辑:我的假装版本是8.1.1
EDIT2:我的tomcat版本是8.5.20