Spring RestTemplate Send List an get List
<p>I want to make a service with Spring's <code>RestTemplate</code>, in my service side the code is like this : </p>

<pre><code>@PostMapping(path="/savePersonList")
@ResponseBody
public List&lt;Person&gt; generatePersonList(@RequestBody List&lt;Person&gt; person){
    return iPersonRestService.generatePersonList(person);
}
</code></pre>

<p>In client side if I call the  service with this code: </p>

<pre><code>List&lt;Person&gt; p = (List&lt;Person&gt;) restTemplate.postForObject(url, PersonList, List.class);
</code></pre>

<p>I can't use the <code>p</code> object as <code>List&lt;Person&gt;</code>, it will become a <code>LinkedHashList</code>. 
After some research I find a solution that said I have to call the service with exchange method: </p>

<pre><code>ResponseEntity&lt;List&lt;Person&gt;&gt; rateResponse = restTemplate.exchange(url, HttpMethod.POST, personListResult, new ParameterizedTypeReference&lt;List&lt;Person&gt;&gt;() {});
</code></pre>

<p>and with this solution the server can't take the object and raise an exception , what's the correct way?</p>