What is Apache Tomcat, and why do Spring Boot web apps often include it?
Options
- An open source Java web server, embeddable in Boot (Correct option)
- A database engine that is bundled with Spring Boot
- A cloud provider that hosts Spring Boot applications
- A build tool that packages Spring Boot applications
Answer
An open source web server for Java (an implementation of Jakarta Servlet and related specifications) that Spring Boot can embed so your app starts with java -jar
Why
A Java web app needs a server that listens for HTTP requests and passes them to your code.
Tomcat is that kind of server. In the old style you installed Tomcat and deployed a WAR file into it.
Spring Boot can embed Tomcat (or Jetty or Undertow) inside your application, so there is nothing to install: you run the JAR and the server starts.
Remember
Tomcat = the web server inside most Spring Boot apps.