RestTemplate: How to send URL and query parameters together
<p>I am trying to pass path param and query params in a URL but I am getting a weird error. below is the code</p>

<pre><code>    String url = "http://test.com/Services/rest/{id}/Identifier"
    Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
    params.put("id", "1234");
    UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url)
                                        .queryParam("name", "myName");
    String uriBuilder = builder.build().encode().toUriString();
    restTemplate.exchange(uriBuilder , HttpMethod.PUT, requestEntity,
                    class_p, params);
</code></pre>

<p>and my url is becoming <code>http://test.com/Services/rest/%7Bid%7D/Identifier?name=myName</code></p>

<p>what should I do to make it work. I am expecting <code>http://test.com/Services/rest/{id}/Identifier?name=myName</code> so that params will add id to the url</p>

<p>please suggest. thanks in Advance</p>