Spring 6.1 introduced it as the replacement for RestTemplate, with a fluent API and the same threading model.
RestClient client = RestClient.create();
Order order = client.get()
.uri("https://api.example.com/orders/{id}", 42)
.header("Authorization", "Bearer " + token)
.retrieve()
.body(Order.class);
ResponseEntity<Void> created = client.post()
.uri("https://api.example.com/orders")
.contentType(MediaType.APPLICATION_JSON)
.body(request)
.retrieve()
.toBodilessEntity();
Order[id=42, sku=JCH-01, qty=2]
201 CREATED
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-11