Spring Boot Uncover and Combat (v) Server-other embedded servers posted on 2017-01-03 | Spring Framework | Spri

Source: Internet
Author: User

Article Directory

    1. 1. switching of the Jetty
    2. 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.

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-web</artifactId>
  4. <exclusions>
  5. <exclusion>
  6. <groupId>org.springframework.boot</groupId>
  7. <artifactId>spring-boot-starter-tomcat</artifactId>
  8. </exclusion>
  9. </exclusions>
  10. </dependency>

Then, modify the POM file to increase the jetty dependency.

    1. <dependency>
    2. <groupId>org.springframework.boot</groupId>
    3. <artifactId>spring-boot-starter-jetty</artifactId>
    4. </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.

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-web</artifactId>
  4. <exclusions>
  5. <exclusion>
  6. <groupId>org.springframework.boot</groupId>
  7. <artifactId>spring-boot-starter-tomcat</artifactId>
  8. </exclusion>
  9. </exclusions>
  10. </dependency>

Then, modify the POM file to increase the undertow dependency.

    1. <dependency>
    2. <groupId>org.springframework.boot</groupId>
    3. <artifactId>Spring-boot-starter-undertow</artifactId>
    4. </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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.