Spring Boot determines which embedded server to use based on the dependencies available on the application's classpath. During startup, Spring Boot's auto-configuration mechanism scans the project dependencies and automatically configures the appropriate server.
spring-boot-starter-web
As a result, the application starts with Tomcat without any additional configuration.
Application Startup
↓
Classpath Scanning
↓
Check Available Server Dependencies
↓
Apply Auto Configuration
↓
Start Embedded Server
spring-boot-starter-web
Exclude Tomcat dependency.
spring-boot-starter-jetty
Exclude Tomcat dependency.
spring-boot-starter-undertow
Configure Tomcat
Configure Jetty
Configure Undertow
This process happens automatically during application startup.
Each service can use the server best suited for its workload.
<!-- Switch from Tomcat (default) to Jetty: exclude one, add the other -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
// Internally the choice is made with conditions such as:
@ConditionalOnClass({ Servlet.class, Tomcat.class, UpgradeProtocol.class })
@ConditionalOnMissingBean(value = ServletWebServerFactory.class, search = SearchStrategy.CURRENT)Spring Boot 4.0 (November 2025) dropped support for Undertow, because Undertow was not yet compatible with Servlet 6.1. On Spring Boot 4, the embedded server choices are Tomcat and Jetty, so mention this if the interviewer asks about Undertow.
A concise interview answer is: Spring Boot chooses the embedded server by inspecting the dependencies available on the classpath during startup. If Tomcat is present, it is configured by default. If Tomcat is excluded and Jetty or Undertow dependencies are added, Spring Boot automatically configures and starts the available server using its auto-configuration mechanism.
Last updated: 11 November 2026
Previous question: What is Spring Cloud, and how is it useful for building microservices?
Next question: Describe a Spring Boot project where you significantly improved performance. What techniques did you use?