That One Lazy Bean I Didn’t Know About in Spring Boot
It Didn’t Crash, It Just Waited
This wasn’t me trying to shave milliseconds off cold start times. This was a while back, and I was still pretty new to Spring. I opened the logs out of curiosity and noticed the launch felt slower than I remembered. Nothing crashed, no red text in sight, but the browser spinner kept going long after Spring said the context was “ready.” I figured it was just one of those random build hiccups. But it kept happening.
The Delay Hid in Plain Sight
Logs looked clean. Actuator’s /health
came back fine. The landing page loaded. But a few endpoints took three or four seconds to respond the first time I hit them. The delay pointed straight to one class: ExpensiveService
.
Keep reading with a 7-day free trial
Subscribe to Alexander Obregon's Substack to keep reading this post and get 7 days of free access to the full post archives.