In the previous example, both variable name and the parameter name are the same. Like Spring JdbcTemplate , RestTemplate is also a high-level API, which in turn is based on an HTTP client. The following GET request is made with query parameters and request headers: Sometimes we want these to be different, though. I was kinda hoping there would be a nicer way to populate my query parameters rather than an ugly concatenated String but there we are. {foobar}, this will cause an exception. In here, the HTTP GET request is made with query parameters (request parameters) and Basic Authentication header. Or, if we aren't using Spring Boot, we may need to do special compile-time configuration or the parameter names won't actually be in the bytecode.
If query parameter contains parenthesis, e.g. With this information in mind I cannot find a way to use the UriComponentsBuilder to send a request to the server, that preserves the + in the query string after it was decoded by tomcats parsing logic. Spring RestTemplate – exchange() method with GET and POST Requests . The safe way is to expand the path variables first, and then add the query parameters: for example: @RequestParam(value = "phone", required = false) List