【笔记】SpringBoot项目不使用Tomcat服务器

前言

SpringBoot项目不使用Tomcat容器作为服务器,改为使用Jetty容器作为服务器

修改依赖配置

  • 将依赖spring-boot-starter-web排除子依赖spring-boot-starter-tomcat
  • 添加spring-boot-starter-jetty依赖
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<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>

完成

参考文献

哔哩哔哩——黑马程序员