How to know which tomcat version embedded in spring boot
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
The embedded Tomcat version in a Spring Boot application is determined by Spring Boot's dependency management, not by any Tomcat installation on your machine. The fastest way to find it is to inspect the resolved dependency tree with mvn dependency:tree | grep tomcat for Maven or ./gradlew dependencies | grep tomcat for Gradle. You can also check it at runtime with ServerInfo.getServerNumber() or by looking inside the packaged JAR or WAR file.
Since Spring Boot manages the Tomcat version through its BOM (Bill of Materials), the version can differ from what you might expect based on the Spring Boot release notes if your project overrides it. Always verify from the actual resolved dependencies rather than assuming.
Method 1: Maven Dependency Tree
The dependency tree is the most reliable build-time check because it shows you what Maven actually resolved, including any overrides.
Typical output:
In this example, the embedded Tomcat version is 10.1.19. The -Dincludes filter narrows the output to only Tomcat artifacts, which is cleaner than grepping the full tree.
Method 2: Gradle Dependency Report
For Gradle projects, use the dependencies task:
Output:
You can also get a more detailed view with the dependencyInsight task:
This shows you exactly why a particular version was selected, including which dependency management rule or override caused it.
Method 3: Programmatic Runtime Check
If you need to verify the Tomcat version from within a running application, use Apache Tomcat's ServerInfo class.
Output:
You can integrate this into your application startup to log the version automatically:
This is especially useful in production where you may not have access to the build tools but need to verify a security patch was applied.
Method 4: Inspect the Packaged Artifact
After building your application, you can inspect the JAR or WAR file directly.
The version number is part of the filename. This is particularly useful in deployment scenarios where you want to verify exactly what was shipped, not what the source build file claims.
For WAR files:
Method 5: Check the Spring Boot BOM
If you want to know the default Tomcat version for a specific Spring Boot release without building a project, check the BOM.
Output:
This is the default. Your project may override it.
Spring Boot to Tomcat Version Mapping
Here is a reference table for recent Spring Boot releases and their default embedded Tomcat versions:
| Spring Boot Version | Embedded Tomcat Version | Servlet API |
| 3.3.x | 10.1.24+ | Jakarta Servlet 6.0 |
| 3.2.x | 10.1.18+ | Jakarta Servlet 6.0 |
| 3.1.x | 10.1.8+ | Jakarta Servlet 6.0 |
| 3.0.x | 10.1.1+ | Jakarta Servlet 6.0 |
| 2.7.x | 9.0.65+ | javax.servlet 4.0 |
| 2.6.x | 9.0.56+ | javax.servlet 4.0 |
| 2.5.x | 9.0.46+ | javax.servlet 4.0 |
Note that minor patch versions of Spring Boot often bump the Tomcat version for security fixes. This table shows approximate starting versions per release line. Always verify with the dependency tree for your exact Spring Boot patch version.
Overriding the Embedded Tomcat Version
If you need a specific Tomcat version (for example, to apply a security patch before Spring Boot releases an update), override the version property.
Maven
Gradle
After the override, verify with the dependency tree to confirm the new version is applied across all Tomcat artifacts (core, el, websocket).
Why the Version Matters
Knowing the exact embedded Tomcat version is important for several practical reasons:
- Security patches: CVE advisories reference specific Tomcat version ranges. You need to know your version to determine if you are affected.
- Feature compatibility: Tomcat 10.x uses the
jakarta.*namespace while Tomcat 9.x usesjavax.*. This affects library compatibility. - Bug reproduction: When reporting or investigating a bug, the server version is essential context.
- Compliance audits: Organizations that track software versions for compliance need to report the exact embedded server version.
Common Pitfalls
Confusing the system-installed Tomcat with the embedded one. Spring Boot applications use an embedded Tomcat that is packaged inside the application JAR. The Tomcat installed via apt or brew on your machine is completely unrelated.
Relying on Spring Boot version alone to determine the Tomcat version. Spring Boot patch releases often bump the Tomcat version. Spring Boot 3.2.3 and 3.2.4 may use different Tomcat versions. And your project may override the default.
Forgetting that spring-boot-starter-web pulls in Tomcat by default, but spring-boot-starter-webflux uses Netty. If your application uses WebFlux, there is no embedded Tomcat unless you explicitly added the dependency.
Checking source build files instead of resolved dependencies. A pom.xml might not explicitly mention a Tomcat version because Spring Boot's BOM manages it. The dependency tree is the source of truth, not the build file.
Not verifying after an override. After setting <tomcat.version>, run mvn dependency:tree to confirm all Tomcat artifacts resolved to the expected version. Partial version mismatches across Tomcat modules can cause subtle runtime errors.
Summary
The embedded Tomcat version in Spring Boot is best discovered from resolved dependencies, not from the Spring Boot version number alone. Use mvn dependency:tree or ./gradlew dependencies for build-time verification. Use ServerInfo.getServerNumber() for runtime checks. Inspect the packaged artifact with jar tf when verifying deployed applications. If you need to override the default Tomcat version, set the tomcat.version property and verify all Tomcat artifacts resolve consistently.
Related reading
- How to list all AWS S3 objects in a bucket using Java
- How to load JAR files dynamically at Runtime?
- How to log all active properties of a spring boot application before the beans instantiation?
- How to log request and response bodies in Spring WebFlux
- how to log Spring 5 WebClient call
- How to log the active configuration in a Spring Boot application?
- How to maintain bi-directional relationships with Spring Data REST and JPA?
- How to make a countdown timer in Android?

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.