Eureka 2.2.3 后,似乎 restTemplate.getForEntity 时默认将接收到的 json 转为 xml
可以使用 exchange 并指定 reponseType
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
HttpEntity<Object> entityForGet = new HttpEntity<>(null, headers);restTemplate.exchange(url, HttpMethod.GET, entityForGet, User.class).getBody();