解决方案
spring.jackson.deserialization.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT=true
异常信息
feign.codec.DecodeException: Error while extracting response for type [com.test.BizResult<com.test.InviteOrderResp>] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of
com.test.InviteOrderResp
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (''); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance ofcom.test.InviteOrderResp
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('')
at [Source: (ByteArrayInputStream); line: 1, column: 168] (through reference chain: com.test.BizResult["data"])
at feign.AsyncResponseHandler.decode(AsyncResponseHandler.java:119)
at feign.AsyncResponseHandler.handleResponse(AsyncResponseHandler.java:87)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:89)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:100)
http接口返回值
{"code":102,"errorCode":null,"error_code":null,"error_message":null,"status":null,"message":"","data":"","errNo":null}
feign接口
@GetMapping(value = "/api/test")
BizResult<InviteOrderResp> test(@RequestParam("code") String code);
BizResult
@Data
public class BizResult<T> implements Serializable {
private Integer code;
private String message;
private List<IBizCode> errorList;
private BizFlowOperator flowOperator;
private T data;
private long total;
private long current;
private long pageSize;
}
InviteOrderResp
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class InviteOrderResp implements Serializable {
private static final long serialVersionUID = -1L;
private String mobile;
private String name;
}