What is the embedded server in Spring Boot?

Why Interviewers Ask This

Interviewers use this question to quickly assess whether a candidate has the foundational knowledge required for Spring Boot development. It reveals whether you understand the building blocks that more complex concepts rely on.

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.

Pro Tip

Back up your answer with a specific project or situation. Saying 'In my last Spring Boot project, I used this when...' immediately makes your answer more credible and memorable.