Spring boot jetty example

Common servlet container settings can be configured using Spring Environment properties. Usually, you would define the properties in your application.properties file.

Spring boot jetty as an embedded server

Step 1: exclude tomcat from spring boot web starter


  Step 2: Now add Jetty dependency – spring-boot-starter-jetty maven


That’s All…

How to run

mvn spring-boot:run


Jetty as embedded server maven


Alternatively, you can try Programmatic customization for Jetty configuration

If you need to configure your embedded servlet container programmatically you can register a Spring bean that implements the EmbeddedServletContainerCustomizer interface. EmbeddedServletContainerCustomizer provides access to the ConfigurableEmbeddedServletContainer which includes numerous customization setter methods.

import org.springframework.boot.context.embedded.*;
        import org.springframework.stereotype.Component;

public class CustomizationBean implements EmbeddedServletContainerCustomizer {

    public void customize(ConfigurableEmbeddedServletContainer container) {



Leave a Reply

Your email address will not be published. Required fields are marked *