RestTemplate: How to send URL and query parameters together
问题 I am trying to pass path param and query params in a URL but I am getting a weird error. below is the code String url = "http://test.com/Services/rest/{id}/Identifier" Map<String, String> params = new HashMap<String, String>(); 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