Spring: RestTemplate and WebClient ship with no timeout at all

The default connect and read timeouts are infinite. One unresponsive dependency holds a request thread forever, and Tomcat's 200 threads are gone in minutes - a total outage caused by a service that never returned an error.

Full code & output

This topic is available to PRO members.

Sign in Create a free account

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-25