Use Jetty instead of Tomcat in Spring Boot application

Introduction

Spring Boot web starter uses Tomcat as the default embedded servlet container or Tomcat is the default embedded server. In this example we will see how to use Jetty instead of Tomcat in Spring Boot application.

Configurations

Generally we need to exclude the Tomcat server and use the Jetty starter in the dependency either in maven pom.xml file or gradle build.gradle file.

Maven based Configuration

If you use maven based Spring Boot application then do the Tomcat exclusion from your web starter as shown below: