Article Directory
- 1. switching of the Jetty
- 2. Use of Undertow
Spring Boot has the option to embed Tomcat, Jetty, and undertow, so we don't need to deploy the project as a war package. "Spring Boot Secret and actual combat (v) Server-embedded server Tomcat Anatomy" article, has explained the embedded server Tomcat, then, this article about the other two embedded servers Jetty and undertow.
switching of the Jetty
Spring boot uses Tomcat as the embedded server by default, but spring boot also supports Jetty as an embedded server.
If you want to use a Jetty server, we only need to do two steps.
First, modify the POM file to exclude 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>
Then, modify the POM file to increase the jetty dependency.
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jetty</artifactId>
- </dependency>
Use of Undertow
Undertow is a flexible, high-performance WEB server developed in Java that provides non-clogging mechanisms including blocking and NIO-based. Undertow is a red Hat open source product and is the Wildfly default Web server.
Spring Boot also has a good support for undertow, which is used as an embedded server.
If you want to use a undertow server, we only need to do two identical configurations.
First, modify the POM file to exclude 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>
Then, modify the POM file to increase the undertow dependency.
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>Spring-boot-starter-undertow</artifactId>
- </dependency>
Finish
If you feel that my article is helpful to you, please feel free to make a reward.
- Copyright NOTICE: This article was published by Liang in Liang Blog
- Reprint statement: Free reprint-Non-commercial-non-derivative-maintain attribution (Creative Sharing 3.0 license), non-commercial reprint please indicate the author and source, commercial reprint please contact the author himself.
- Article title: Spring Boot Secrets and Combat (V) Server-Other embedded servers
- Article Link: http://blog.720ui.com/2017/springboot_05_server_jetty_undertow/
Spring Boot Uncover and Combat (v) Server-other embedded servers posted on 2017-01-03 | Spring Framework | Spri