Introducing RestClient: A New Synchronous HTTP Client in Spring Framework 6.1
The article introduces RestClient, a new synchronous HTTP client in Spring Framework 6.1. RestClient offers a fluent API similar to WebClient and utilizes the message converters, request factories, interceptors, and other components of RestTemplate. It provides easy ways to create a RestClient using static create methods or RestClient::builder with additional options. Developers can use RestClient to make GET and POST requests, handle errors, and perform advanced scenarios using the exchange method. RestClient supports various features in Spring Framework 6.1, including usage with MockRestServiceServer and as the backend for @HttpExchange interfaces. The article also mentions that Spring Boot 3.2 M1 will include support for RestClient. This new addition to Spring Framework provides developers with a powerful tool for making synchronous HTTP requests and handling responses effectively.