What is the embedded server in Spring Boot?
Answer
Spring Boot includes an embedded servlet container — a fully configured web server bundled within the application JAR. No need to install or configure an external server. Default: Apache Tomcat. The spring-boot-starter-web includes spring-boot-starter-tomcat. The application runs as a standalone JAR: java -jar myapp.jar. Available embedded servers: Tomcat (default), Jetty (lightweight, good for long-lived connections), Undertow (high-performance, Wildfly's server), Netty (for reactive WebFlux applications). Switching to Jetty: <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>. Configuration: server.port=8080 server.servlet.context-path=/api server.tomcat.max-threads=200 server.ssl.key-store=classpath:keystore.p12 server.ssl.key-store-password=secret server.compression.enabled=true. Programmatic configuration: implement WebServerFactoryCustomizer<TomcatServletWebServerFactory> for advanced Tomcat configuration. WAR deployment: extend SpringBootServletInitializer and package as WAR if deploying to external server — but JAR with embedded server is the standard.