Spring Boot nhúng web server (Tomcat/Jetty/Undertow) vào JAR — deploy như executable, không cần cài server riêng. Mặc định: Tomcat (spring-boot-starter-web).
Đổi sang Jetty: exclude Tomcat khỏi starter-web rồi thêm spring-boot-starter-jetty:
xml
<dependency>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions><exclusion><artifactId>spring-boot-starter-tomcat</artifactId></exclusion></exclusions>
</dependency>
<dependency><artifactId>spring-boot-starter-jetty</artifactId></dependency>| Tomcat | Jetty | Undertow | |
|---|---|---|---|
| Default | ✅ | ❌ | ❌ |
| Memory | Trung bình | Thấp | Thấp |
| Use case | General | Lightweight | High concurrency |
Tuỳ chỉnh qua server.* trong application.yml (server.port, server.tomcat.threads.max...). Ưu điểm: java -jar app.jar một lệnh, mỗi microservice có server riêng, Docker-friendly.