在Java Web的世界裡有好多的Application Server可供選擇,例如WebSphere、Weblogic、Jboss、Tomcat EE、Paraya等等,也有只有Servlet Container的Web Server可供選擇,例如Tomcat、Undertow、Jetty等
。Spring Boot的一大特色之一就是自帶Web Server,提供Tomcat、Undertow、Jetty可供選擇,今日我們來談談Embedded Web Server吧


從這個類別自動裝配WebServer
 
<properties>
    <servlet-api.version>3.1.0</servlet-api.version>
</properties>
<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>
<!-- Use Undertow instead -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

server:
  port: 9999
