Spring Boot How to change the Tomcat to Jetty Server

By |2018-08-04T17:18:23+05:30May 1st, 2017|Spring Boot|

In this tutorial, I am going to show you how to change the Tomcat to Jetty Server in Spring Boot application.

Tomcat to Jetty Server :

Tomcat is the embedded default server coming with Spring Boot. To change the Tomcat to Jetty server, we should change the dependencies in pom.xml like below.

pom.xml

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
</dependencies>

Refresh the dependencies and check the mvn dependency:tree.

Maven dependency tree :

console
[INFO] org.springframework.samples:Spring_Boot_Example:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.5.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.1.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.9:compile
[INFO] |  |  |  |  +- ch.qos.logback:logback-core:jar:1.1.9:compile
[INFO] |  |  |  |  \- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.22:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.22:compile
[INFO] |  |  +- org.springframework:spring-core:jar:4.3.6.RELEASE:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.1.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:compile
[INFO] |  +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
[INFO] |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.6:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO] |  +- org.springframework:spring-web:jar:4.3.6.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.3.6.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:4.3.6.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-context:jar:4.3.6.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:4.3.6.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:4.3.6.RELEASE:compile
[INFO] \- org.springframework.boot:spring-boot-starter-jetty:jar:1.5.1.RELEASE:compile
[INFO]    +- org.eclipse.jetty:jetty-servlets:jar:9.4.1.v20170120:compile
[INFO]    |  +- org.eclipse.jetty:jetty-continuation:jar:9.4.1.v20170120:compile
[INFO]    |  +- org.eclipse.jetty:jetty-http:jar:9.4.1.v20170120:compile
[INFO]    |  +- org.eclipse.jetty:jetty-util:jar:9.4.1.v20170120:compile
[INFO]    |  \- org.eclipse.jetty:jetty-io:jar:9.4.1.v20170120:compile
[INFO]    +- org.eclipse.jetty:jetty-webapp:jar:9.4.1.v20170120:compile
[INFO]    |  +- org.eclipse.jetty:jetty-xml:jar:9.4.1.v20170120:compile
[INFO]    |  \- org.eclipse.jetty:jetty-servlet:jar:9.4.1.v20170120:compile
[INFO]    |     \- org.eclipse.jetty:jetty-security:jar:9.4.1.v20170120:compile
[INFO]    |        \- org.eclipse.jetty:jetty-server:jar:9.4.1.v20170120:compile
[INFO]    +- org.eclipse.jetty.websocket:websocket-server:jar:9.4.1.v20170120:compile
[INFO]    |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.1.v20170120:compile
[INFO]    |  |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.1.v20170120:compile
[INFO]    |  +- org.eclipse.jetty.websocket:websocket-client:jar:9.4.1.v20170120:compile
[INFO]    |  |  \- org.eclipse.jetty:jetty-client:jar:9.4.1.v20170120:compile
[INFO]    |  \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.1.v20170120:compile
[INFO]    |     \- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO]    +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.1.v20170120:compile
[INFO]    |  +- org.eclipse.jetty:jetty-annotations:jar:9.4.1.v20170120:compile
[INFO]    |  |  +- org.eclipse.jetty:jetty-plus:jar:9.4.1.v20170120:compile
[INFO]    |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO]    |  |  +- org.ow2.asm:asm:jar:5.1:compile
[INFO]    |  |  \- org.ow2.asm:asm-commons:jar:5.1:compile
[INFO]    |  |     \- org.ow2.asm:asm-tree:jar:5.1:compile
[INFO]    |  +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.4.1.v20170120:compile
[INFO]    |  \- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO]    \- org.mortbay.jasper:apache-el:jar:8.0.33:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:06 min
[INFO] Finished at: 2017-04-30T19:12:52+05:30
[INFO] Final Memory: 24M/156M
[INFO] ------------------------------------------------------------------------

Happy Learning 🙂

About the Author:

Hi Folks, you have reach this so far, that shows you like what you are learning. Then why don't you support us to improve for bettor tutorials by leaving your valuable comments and why not you keep in touch with us for latest updates on your favorite blog @ facebook , twitter , Or Google+ ,

Leave A Comment