Sitemap

Member-only story

Spring Boot Was Taking 25 Seconds to Start — Java 21 Fixed Most of It

4 min readDec 28, 2025

--

For a long time, I ignored it.

Our Spring Boot application took 25 seconds to start.
Locally.
On a decent machine.

“It’s fine,” I told myself.
“Production servers are faster.”
“We don’t restart that often.”

All lies.

One day, during a production incident, we had to restart multiple services. That’s when it hit me: slow startup is not just annoying — it’s operational risk.

So I finally decided to fix it.

This is how I reduced our Spring Boot startup time from ~25 seconds to ~4 seconds, without rewriting the app or switching frameworks.

Step 1: Measure First (Not Guess)

Before changing anything, I turned on startup timing logs.

spring.main.log-startup-info=true

Then I started the app with:

java -jar app.jar

Spring Boot logs showed me exactly where time was being spent.

What surprised me?

Most time was not spent in business logic

--

--

The Java programming language is one of the most popular languages today. Stay up to date with news, certifications, free learning resources and much more.