How to Generate Interactive Spring Boot Startup Reports for Faster Apps
This guide explains how to add the spring-boot-startup-report library to a Spring Boot project, generate interactive HTML startup reports with bean details and flame graphs, view them during runtime or integration tests, and configure the dependency for production or test scopes.
Spring Boot Startup Report
The library generates an interactive HTML page that shows detailed startup information, bean instantiation, flame graphs, and allows searching by class or annotation.
Features
Interactive HTML page available at runtime
Generated during integration tests
Flame graph visualization
Search by class or annotation
The report table provides deep insight into bean creation.
Flame graph offers a more visual representation.
How to Use
Note: The report generation requires Jackson on the classpath. If you already have spring-boot-starter-web or spring-boot-starter-json , you are fine; otherwise add the Jackson dependency:
<code><dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</code>Add the
spring-boot-startup-reportdependency:
<code><dependency>
<groupId>com.maciejwalkowiak.spring</groupId>
<artifactId>spring-boot-startup-report</artifactId>
<version>0.1.0</version>
<optional>true</optional>
</dependency>
</code>Run the application and visit
http://localhost:8080/startup-report.
Be aware the library depends on
org.springframework:spring-testand
org.springframework.boot:spring-boot-test; consider marking it as optional for production builds.
Using with Unit Tests
When on the classpath, the library automatically generates a startup report for each application context during integration tests annotated with @SpringBootTest. Reports are placed in
target/startup-reports(Maven) or
build/startup-reports(Gradle).
For test slices such as @WebMvcTest or @DataJpaTest, add
@Import(StartupEventsAutoConfiguration.class)at the top of the test class:
<code>@Import(StartupEventsAutoConfiguration.class)
@WebMvcTest(OwnerController.class)
public class OwnerControllerTests {
...
}
</code>If you only need test reports without a runtime endpoint, declare the dependency with
testscope:
<code><dependency>
<groupId>com.maciejwalkowiak.spring</groupId>
<artifactId>spring-boot-startup-report</artifactId>
<version>0.1.0</version>
<scope>test</scope>
</dependency>
</code>Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.