您甚至不需要
ResponseEntitys!只需使用
getForObject一个
String.class喜欢:
final RestTemplate restTemplate = new RestTemplate();final String response = restTemplate.getForObject("https://httpbin.org/ip", String.class);System.out.println(response);它将打印如下内容:
{ "origin": "1.2.3.4"}


