对于servlet 技术栈,spring boot 提供了对应的servlet容器,包含tomcat,jetty,undertow,默认使用tomcat,可以替换
starter 信息
spring-boot-starter-tomcat
spring-boot-starter-jetty
spring-boot-starter-undertow
maven 依赖配置如下
<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 Jetty instead -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>