美文网首页springboot工作总结
springboot更改web容器

springboot更改web容器

作者: 二月_春风 | 来源:发表于2017-08-08 00:02 被阅读60次

    springboot web默认使用的是tomcat作为web容器,依赖如下,

    <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    </dependencies>
    

    启动类启动,



    看到默认的使用的是tomcat容器,如果我要改成其他容器呢?
    修改依赖,在spring-boot-starter-web中排除spring-boot-starter-tomcat依赖,然后加入jetty依赖

    <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>
         <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jetty</artifactId>
         </dependency>
    </dependencies>
    

    相关文章

      网友评论

        本文标题:springboot更改web容器

        本文链接:https://www.haomeiwen.com/subject/bktzkxtx.html