问题描述
我正在使用带有Spring-boot 2.1.3版本的Java 11。我在代码中使用了第三方服务。
第三方服务返回org.springframework.http.ResponseEntity(属于org.springframework:spring-web:5.1.5.RELEASE)。
现在,由于ResponseEntity没有任何默认构造函数,我在自动解组第三方响应时遇到了问题。
第三方服务签名的伪代码:
@POST
public ResponseEntity<Abc> PostABC(){
// Some logic
return responseEntity;
}
ResponseEntity<Abc> response = client.PostABC();
错误:
javax.ws.rs.client.ResponseProcessingException: com.fasterxml.jackson.databind.exc.InvalidDeFinitionException: Cannot construct instance of `org.springframework.http.ResponseEntity` (no Creators,like default construct,exist): cannot deserialize from Object value (no delegate- or property-based Creator)
为什么ResponseEntity没有默认构造函数? 如何解决此问题?
注意::我正在获取LinkedHashMap,因为JSON无法转换为ResponseEntity
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)