更新时间:2022-01-10 17:24:42
您需要执行以下操作:
public class CountryInfoResponse {
@JsonProperty("geonames")
private List<Country> countries;
//getter - setter
}
RestTemplate restTemplate = new RestTemplate();
List<Country> countries = restTemplate.getForObject("http://api.geonames.org/countryInfoJSON?username=volodiaL",CountryInfoResponse.class).getCountries();
如果您可以使用某种注释来跳过级别会很棒,但它是还不可能(参见这个和 this )
It would be great if you could use some kind of annotation to allow you to skip levels, but it's not yet possible (see this and this)