Repaso
Español
Spring, JPA & Java WebFoundationsSPR-41

What is Apache Tomcat, and why do Spring Boot web apps often include it?

Options

  1. An open source Java web server, embeddable in Boot (Correct option)
  2. A database engine that is bundled with Spring Boot
  3. A cloud provider that hosts Spring Boot applications
  4. 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.

Key terms

Practice this question in Repaso