Spring Boot supports several embedded containers, which are lightweight servlet containers that can be embedded directly into your Spring Boot application. These containers eliminate the need for deploying your application to a separate application server, making it easier to package and deploy your Spring Boot application as a standalone executable JAR file. Here are some of the embedded containers supported by Spring Boot:
- Tomcat: Apache Tomcat is one of the most widely used servlet containers in the Java ecosystem. Spring Boot has built-in support for embedding Tomcat, allowing you to run your Spring Boot application using Tomcat without any additional configuration.
- Jetty: Jetty is another popular servlet container known for its lightweight and high-performance characteristics. Spring Boot includes support for embedding Jetty, enabling you to run your Spring Boot application using Jetty as the embedded server.
- Undertow: Undertow is a lightweight and high-performance web server designed for modern applications. Spring Boot provides support for embedding Undertow, allowing you to run your Spring Boot application using Undertow as the embedded servlet container.
By default, Spring Boot uses Tomcat as the embedded servlet container. However, you can easily switch to Jetty or Undertow by including the corresponding dependencies in your project's pom.xml
or build.gradle
file and excluding the Tomcat dependency. Additionally, Spring Boot provides configuration properties that allow you to customize various aspects of the embedded containers, such as port configuration, HTTP/2 support, and SSL/TLS configuration. This flexibility makes it easy to tailor the embedded container to suit your application's requirements.