Files
spring-boot-demo/spring-boot-startup-time/post/meta.md
T
asmhatre 29676e0cc8 Spring Boot startup time: bean-by-bean diagnosis, and one directory per post
Adds spring-boot-startup-time/, the companion project for BLOG-618: a runnable
Spring Boot 4.1.1 application on JDK 25 that installs BufferingApplicationStartup
and FlightRecorderApplicationStartup behind a system property, and a /diag/startup
endpoint that computes step self time -- the number /actuator/startup does not give
you and the one that names the actual culprits.

Captured under docs/output/: the step tree sorted both ways, the same startup as JFR
events, a +5000-class experiment putting 0.11 ms per scanned class on the classpath
scan tax, the silent truncation a 2048-step buffer performs, and JDK 25 AOT cache
timings (6.93 s to 4.82 s). Post body and metadata live in post/.

Moves the existing Actuator project into actuator-in-production/ so the repository
holds one directory per article; the root README is now an index.
2026-09-04 23:58:38 +05:30

1.5 KiB

Post metadata

Title

Why Your Spring Boot App Takes 8 Seconds to Start: A Bean-by-Bean Diagnosis

Slug

spring-boot-startup-time-bean-by-bean-diagnosis

Excerpt

Spring Boot logs one startup number and hides four phases behind it. This walks through turning on the ApplicationStartup instrumentation that ships switched off, reading the step tree by self time rather than total duration — the mistake that makes people optimise a bean costing 10 ms instead of the one costing 504 — and then puts measured numbers on component scanning (0.11 ms per class inspected, whether or not it is a bean), on the silent truncation a 2048-step buffer performs on your recording, and on the JDK 25 AOT cache, which took 6.93 s to 4.82 s on the companion project without a line of application code changing.

Categories

Java (328), Spring (355)

Yoast

  • _yoast_wpseo_title: Spring Boot Startup Time: A Bean-by-Bean Diagnosis
  • _yoast_wpseo_metadesc: Turn on Spring Boot's built-in startup instrumentation, read the step tree by self time, and see measured numbers for component scanning, buffer truncation and the JDK 25 AOT cache.
  • _yoast_wpseo_focuskw: spring boot startup time

Companion repository

asmhatre/spring-boot-demo → spring-boot-startup-time/

Jira

BLOG-618

Verified against

Spring Boot 4.1.1 (GA 20 August 2026), Spring Framework 7.0.9, Spring Data JPA 4.1.1, Hibernate ORM 7.4.5.Final, Tomcat 11.0.24, Micrometer 1.17.1, H2 2.4.240, Temurin 25.0.4.1+1 LTS, Maven 3.9.11.