What is the difference between embedded and external application server deployment in Spring Boot?

Embedded server deployment bundles a servlet container (Tomcat, Jetty, or Undertow) directly inside the application's JAR, while external server deployment packages the app as a WAR that gets installed onto a separately managed server.

Key Points: • Embedded: run with java -jar, the app is fully self-contained and portable. • External: the app is deployed as a WAR into a container like Apache Tomcat that manages multiple applications. • Embedded deployment simplifies CI/CD and containerization, since there's a single artifact to ship. • External deployment suits environments where several applications must share one server instance for centralized administration or licensing reasons. • Switching between the two mainly involves changing the packaging type (jar vs war) and how the SpringBootServletInitializer is configured.

Example: A microservices team running each service in its own Docker container almost always prefers the embedded model, while a legacy enterprise team consolidating a dozen apps onto one managed Tomcat cluster would choose external WAR deployment.

Interview Tip: A concise interview answer is:

"With embedded deployment, Spring Boot packages Tomcat or Jetty right into the JAR so you run it standalone with java -jar. With external deployment, you build a WAR and deploy it onto a server that's managed separately and may host multiple applications. Embedded is simpler and more portable; external fits shared-server enterprise setups."