SpringBoot---Servlet容器(Tomcat)配置

1、概述

    1.1、Tomcat所有属性  都在org,springframework.boot.autoconfigure.web.ServerProperties配置类中作了定义;

2、替换Tomcat

    2.1、SpringBoot默认使用Tomcat作为Servlet容器,如果想使用Jetty或者其他作为Servlet容器,只需要修改spring-boot-starter-web的依赖即可;

<!--   将SpringBoot默认的Servlet容器Tomcat换为Jetty     -->
        <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>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>

  

猜你喜欢

转载自www.cnblogs.com/anpeiyong/p/11938145.html