Get Json object from Itis with spring boot

I try to get a Json object from Itis Webservice (https://www.itis.gov/ITISWebService/jsonservice/getHierarchyUpFromTSN?tsn=164282). I use the following class to store the Json object:

public class Genus {

     @JsonProperty("tsn")
    private int tsn;

     @JsonProperty("taxonName")
    private String taxonName;

    public Genus() {
        super();
    }

    public int getTsn() {
        return tsn;
    }
    public void setTsn(int tsn) {
        this.tsn = tsn;
    }
    public String getCombinedName() {
        return taxonName;
    }
    public void setCombinedName(String taxonName) {
        this.taxonName = taxonName;
    }   

    @Override
    public String toString() {
        return "Genus [tsn=" + tsn + ", taxonName=" + taxonName + "]";
    }
} 

My main method:

    public static void main(String[] args) {
            RestTemplate restTemplate = new RestTemplate();
            Genus quote = restTemplate.getForObject("https://www.itis.gov/ITISWebService/jsonservice/getHierarchyUpFromTSN?tsn=164282", Genus.class);
             System.out.println(quote.toString());
}

As result I get the following exception:

Exception in thread "main" org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class de.aquaristikguru.taxonomy.itisObjects.Genus] and content type [text/json;charset=ISO-8859-1

How can I fixed it?

链接地址: http://www.djcxy.com/p/48190.html

上一篇: 生成的代码使用PHP

下一篇: 用弹簧启动从Itis中获取Json对象