Spring
Follow
The state of HTTP clients in Spring
The blog post announces the deprecation of RestTemplate in favor of the new RestClient. RestClient, introduced in Spring Framework 6.1 and evolving in the 6.x line, will receive new features in version 7.0. These features include API versioning support for both server and client sides, a simplified HttpMessageConverters configuration, and Http Interface Groups for organizing multiple clients. Spring Framework 7.0 will also introduce RestTestClient for integration testing. New Spring Boot starters, such as spring-boot-starter-restclient, will improve dependency management for HTTP clients. RestTemplate is being deprecated due to its outdated "template-style" API, which makes adding new features like API versioning and asynchronous calls difficult. In contrast, WebClient, developed for the reactive stack, offers a modern fluent API and supports non-blocking operations and streaming. RestClient aims to bridge the gap by providing a modern, fluent API while leveraging existing HTTP infrastructure, facilitating a smoother transition for developers.