Using Embedded Jetty Server For Spring Boot Application

By default spring boot web starter uses embedded tomcat server. In this article, we will learn how to use embedded jetty server instead of default tomcat server.

To enable jetty server in spring boot application, we have to exclude tomcat server dependency in our pom.xml file.

Then we have to add spring boot starter jetty dependency as given below.


We can use gradle build tool as shown below.

configurations {
    compile.exclude module: "spring-boot-starter-tomcat"

dependencies {

Jetty server configuration properties

Few of the jetty server configuration properties shown below. These are few of the supported Click here for all available properties list.


server.jetty.accesslog.append=true # Append to log. Z # Timestamp format of the request log.
server.jetty.accesslog.enabled=true # Enable access log.

Jetty server programmatic Customization

We can implement WebServerFactoryCustomizer interface to customize server configuration.

Below is the programmatic customization of server port and application context path.

public class SpringBootJettyApplication implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {

	public static void main(String[] args) {, args);

	public void customize(ConfigurableServletWebServerFactory factory) {

Congratulations!! We have configured embedded Jetty server for our spring boot application! 🙂 Let us run the application. 🙂

We can be able to see server is getting started with configured server configuration.

spring boot jetty configuration example


In this article, we learned about how to use embedded jetty server in spring boot application.

Happy coding!! 🙂 🙂

You may also interested in