Can we override or replace the Embedded Tomcat server in Spring Boot?

Spring Boot uses Embedded Tomcat as the default web server, but it can be replaced or customized with other embedded servers such as Jetty or Undertow based on application requirements such as performance, memory usage, or asynchronous processing capabilities.

Key Points

Example

A high-concurrency real-time application may prefer Undertow because of its lightweight and non-blocking architecture, while a traditional enterprise application may continue using Tomcat.

Replacing Embedded Tomcat

Step 1

Exclude Tomcat dependency.

Step 2

Add the desired server dependency.

For Jetty

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

For Undertow

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

Spring Boot automatically detects the available server and configures it during application startup.

Comparison

Tomcat

Jetty

Undertow

Customizing Embedded Tomcat

Even without replacing Tomcat, we can customize it using application properties.

Example

server.port=9090
server.tomcat.max-threads=300
server.tomcat.accept-count=100

Common Customizations

Real-World Example

An API Gateway handling thousands of requests per second may use Undertow for better throughput, while a standard business application may continue using Tomcat due to its maturity and stability.

Benefits of Embedded Servers

Interview Tip

A concise interview answer is: Yes, Spring Boot allows replacing the default Embedded Tomcat server with Jetty or Undertow by excluding the Tomcat dependency and adding the desired server starter dependency. Spring Boot automatically configures the new server, making the transition seamless without requiring application code changes.

Last updated: 16 July 2026

Previous question: Discuss the integration of Spring Boot applications with CI/CD pipelines.

Next question: How do you fix the Whitelabel Error Page in a Spring Boot application?

More Spring Boot - Level II interview questions

All Spring Boot - Level II questions