RestTemplate Articles
-
Implementing a Synchronous HTTP Client with RestClient in Spring Boot 3.2 - Migrating from RestTemplate/WebClient
A hands-on guide to implementing RestClient, added in Spring Boot 3.2. This article covers GET/POST/PUT/DELETE with the fluent API, error handling with onStatus, connect/read timeouts, testing with MockRestServiceServer, migration steps from RestTemplate, and how to choose between WebClient and @HttpExchange.
-
How to Test External API Calls with WireMock in Spring Boot - From import Setup to Practice
A practical guide to introducing WireMock into Spring Boot tests and defining external API stubs at the HTTP level, covering success cases, error cases, and timeouts. Also explains the correct import statement for WireMock 3.x's new package org.wiremock.client.WireMock, as well as criteria for choosing between Mockito and WireMock.
-
How to Call REST APIs in Spring Boot - When to Use RestTemplate vs WebClient
A practical guide to the two main approaches for calling external REST APIs in Spring Boot: RestTemplate and WebClient. Covers basic usage, criteria for choosing between them, timeout configuration, and error handling.