Spring 响应性<;MyDTO>;正在返回丢失/不完整的JSON

Spring 响应性<;MyDTO>;正在返回丢失/不完整的JSON,spring,spring-boot,Spring,Spring Boot,在Spring Boot中从我的服务获得响应时,我发现JSON截止/丢失/不完整存在问题 例如: ResponseEntity<MyDTO> responseEntity = myService.getMyDTO(); return responseEntity; 调试: MyDTO body information firstName > "John" lastName > "Doe" address > null

在Spring Boot中从我的服务获得响应时,我发现JSON截止/丢失/不完整存在问题

例如:

ResponseEntity<MyDTO> responseEntity = myService.getMyDTO();
return responseEntity;
调试:

MyDTO
  body
    information
      firstName > "John"
      lastName > "Doe"
    address > null
预期的JSON:

{
  "information": {
    "firstName": "John",
    "lastName": "Doe"
  },
  "address: null
}
实际JSON:

{
  "information": {
    "firstName": "Jo
是的,响应JSON中甚至缺少结束括号

注意:地址为空,因为来自上游服务的响应返回400,我们将该响应映射到我们的DTO(MyDTO)。起初,我认为这是问题所在,直到调试确认映射正确完成。

这才是真正奇怪的。如果我把这个反应放在另一个反应中,它会很好的恢复正常。这项服务甚至恢复得更快,这也很奇怪

ResponseEntity responseEntity = myService.getMyDTO();
return new ResponseEntity(responseEntity.getBody(), responseEntity.getStatusCode());

有人知道发生了什么吗?这是网络、Spring引导还是我的代码问题?为什么返回新的响应才能解决问题?

找到了问题。上游服务包含一个“Content Length”头,该头太小,导致客户端缺少/不完整的JSON。

发现了问题。上游服务包含一个“Content Length”标头,该标头太小,导致客户端缺少/不完整的JSON。

能否共享
myService.getMyDTO()的代码?刚刚添加了MyService.getMyDTOI的代码,我想是超时了。RestTemplate请求的超时时间是多少?我没有考虑这个问题,但不确定是否是这样,因为MyDTO的所有字段都存在。这只是客户端的意外情况。发生异常时,客户端必须断开连接。您可以共享
myService.getMyDTO()的代码吗?刚刚添加了MyService.getMyDTOI的代码,我想是超时了。RestTemplate请求的超时时间是多少?我没有考虑这个问题,但不确定是否是这样,因为MyDTO的所有字段都存在。只是客户端出现意外情况。发生异常时,客户端必须正在断开连接
{
  "information": {
    "firstName": "Jo
ResponseEntity responseEntity = myService.getMyDTO();
return new ResponseEntity(responseEntity.getBody(), responseEntity.getStatusCode());