title: Issue When Consume Rest Service with RestTemplate in Desktop App
body: <p>I have a problem when Consume Rest Service with RestTemplate in Desktop App whereas the problem doesn't appear when i use in Web app.</p>
  
  <p>This Is the Debugging logs</p>
  
  <pre><code>15:30:40.448 [main] DEBUG o.s.web.client.RestTemplate - Reading [java.util.List] as "application/json" using [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter@98adae2]
  15:30:40.452 [main] DEBUG httpclient.wire.content - &lt;&lt; "[{"name":"Indonesia","id":1},{"name":"AlaySia","id":2},{"name":"Autraliya","id":3}]"
  </code></pre>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to com.mgm.domain.Country</p>
  </blockquote>
  
  <p>And this is the Code that i use.</p>
  
  <pre><code> String url = "http://localhost:8080/mgm/country";
      List&lt;MediaType&gt; mediaTypes = new ArrayList&lt;MediaType&gt;();
      mediaTypes.add(MediaType.APPLICATION_JSON);
      HttpHeaders headers = new HttpHeaders();
      headers.setAccept(mediaTypes);
      HttpEntity&lt;Country&gt; httpEntity = new HttpEntity&lt;Country&gt;(null, headers);
      try {
          ResponseEntity&lt;List&gt; responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, List.class);
          List&lt;Country&gt; countries = responseEntity.getBody();
          System.out.println(countries.get(0).getName());
  
      } catch (RestClientException exception) {
          exception.printStackTrace();
      }
  </code></pre>
  
  <p>Code above doesn't give errors when i place it in web app. I use Spring Rest MVC to Provide JSON and Consume it with RestTemplate.</p>
  
  <p>I think there is a problem when Jackson Convert <code>java.util.LinkedHashMap</code> to <code>Country</code> . it Seems that <code>countries.get(0)</code> actually has <code>LinkedHashMap</code> type not <code>Country</code> and problem will appeared when i invoke one of <code>Country</code> methode like <code>.getName()</code></p>