Spring boot provide default tomcat as web container but also provide spring boot jetty server configuration using maven.

Add following dependency in maven pom.xml file:

pom.xml

<dependencies>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-web</artifactId>
           <exclusions>
               <!-- Exclude the Tomcat dependency -->
               <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-jetty</artifactId>   // for spring boot jetty server configuration 
       </dependency>
   </dependencies>

At startup it will display following message

2017-07-29 13:20:17.344  INFO 38284 --- [           main] o.e.jetty.server.AbstractConnector       : Started [email protected]{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2017-07-29 13:20:17.347  INFO 38284 --- [           main] .s.b.c.e.j.JettyEmbeddedServletContainer : Jetty started on port(s) 8080 (http/1.1)
2017-07-29 13:20:17.354  INFO 38284 --- [           main] com.javadeveloperzone.SpringBootConfig   : Started SpringBootConfig in 4.536 seconds (JVM running for 5.263)

Spring Boot provide following configuration for jetty server

server.jetty.acceptors= # Number of acceptor threads to use.
server.jetty.accesslog.append=false # Append to log.
server.jetty.accesslog.date-format=dd/MMM/yyyy:HH:mm:ss Z # Timestamp format of the request log.
server.jetty.accesslog.enabled=false # Enable access log.
server.jetty.accesslog.extended-format=false # Enable extended NCSA format.
server.jetty.accesslog.file-date-format= # Date format to place in log file name.
server.jetty.accesslog.filename= # Log filename. If not specified, logs will be redirected to "System.err".
server.jetty.accesslog.locale= # Locale of the request log.
server.jetty.accesslog.log-cookies=false # Enable logging of the request cookies.
server.jetty.accesslog.log-latency=false # Enable logging of request processing time.
server.jetty.accesslog.log-server=false # Enable logging of the request hostname.
server.jetty.accesslog.retention-period=31 # Number of days before rotated log files are deleted.
server.jetty.accesslog.time-zone=GMT # Timezone of the request log.
server.jetty.max-http-post-size=0 # Maximum size in bytes of the HTTP post or put content.
server.jetty.selectors= # Number of selector threads to use.

 

Spring Boot Jetty Server Configuration

Spring Boot Jetty Server Properties

Was this post helpful?
Let us know, if you liked the post. Only in this way, we can improve us.
Yes
No

Leave a Reply

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