How to configure Jetty in spring-boot (easily?)

Elvin picture Elvin · Dec 8, 2013 · Viewed 33.9k times · Source

By following the tutorial, I could bring up the spring-boot with Jetty running using the following dependencies.

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
    </dependency>

However, how could I configure the Jetty server such as:

  1. Server threads (Queue thread pool)
  2. Server connectors
  3. Https configurations.
  4. all those configuration available in Jetty...?

Is there an easy way to do in

  1. application.yml?
  2. Configuration class?

Any example would be greatly appreciated.

Many thanks!!

Answer

Dave Syer picture Dave Syer · Dec 8, 2013

There are some general extension points for servlet containers and also options for plugging Jetty API calls into those, so I assume everything you would want is in reach. General advice can be found in the docs. Jetty hasn't received as much attention yet so there may not be the same options available for declarative configuration as with Tomcat, and for sure it won't have been used much yet. If you would like to help change that, then help is welcome.