Clean β’ Professional
Spring Bootβs Embedded Servers are one of its most powerful features that make Java web development fast, easy, and modern.
Instead of manually installing and configuring an external web server like Tomcat or Jetty, Spring Boot includes a server inside your application, allowing you to run your project as a standalone Java application.
An embedded server is a server packaged inside your application. It provides all the necessary infrastructure to run web applications without relying on an external server.
Key Points:
In short: Your app comes with its own server β plug and play!
Spring Boot automatically detects the web dependencies you add (like spring-boot-starter-web) and starts an embedded server:

spring-boot-starter-web.java -jar app.jar β Embedded server starts automatically β Your app is live.Example:
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
@RestController
class HelloController {
@GetMapping("/hello")
public String hello() {
return "Hello from Spring Boot!";
}
}

Why Tomcat?
Tomcat is the default embedded server because itβs stable, mature, and widely adopted. Most tutorials and enterprise apps rely on Tomcat.
Key Features:
application.properties (e.g., server port, context path)Example:
Change the default port in Spring Boot:
server.port=9090
Why Jetty?
Jetty is lightweight, making it ideal for microservices, Docker containers, or embedded use cases.
Key Features:
Add Jetty starter in pom.xml and exclude Tomcat:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<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>
Why Undertow?
Undertow is designed for high-performance applications with low memory usage. Itβs non-blocking and supports reactive programming, making it perfect for modern microservices.
Key Features:
Add Undertow starter in pom.xml and exclude Tomcat:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
Key Takeaways for Embedded Servers
| Server | Description | Default in Spring Boot |
|---|---|---|
| Tomcat | Full-featured, widely used, reliable for most apps | Yes (Default) |
| Jetty | Lightweight, suitable for microservices | Optional |
| Undertow | High-performance, scalable, low memory usage | Optional |
Switching Servers:
You can replace Tomcat with Jetty or Undertow by adding the respective starter in pom.xml and excluding Tomcat:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<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>

Faster Development
No external server setup. Just add dependency, run, and go.
Standalone Applications
Your Spring Boot app is a single JAR with an embedded server β easy to run anywhere.
Cloud & Docker Ready
Perfect for containerized microservices. Each service can run independently with its own server.
Simpler Deployment
No WAR file, no external server configuration. Deployment is as simple as java -jar app.jar.
Production-Ready Defaults
Embedded servers come with sensible default settings (port 8080, error pages, servlet handling).
Before Spring Boot, developers had to:
This process was time-consuming and error-prone.
Spring Boot solves this by embedding the server directly, letting developers focus on writing application logic, not configuration.
Suppose you want to build a REST API for a ToDo app:
@SpringBootApplication
public class TodoApp {
public static void main(String[] args) {
SpringApplication.run(TodoApp.class, args);
}
}
@RestController
class TodoController {
@GetMapping("/todos")
public List<String> getTodos() {
return List.of("Learn Spring Boot", "Build REST API", "Deploy App");
}
}
Note : When creating tutorials or learning Spring Boot, always emphasize embedded servers β itβs one of the key reasons why Spring Boot is faster and easier than traditional Spring Framework.