Spring Boot含有的内嵌容器
时间: 2024-05-12 10:15:02 浏览: 7
Spring Boot默认包含以下内嵌容器:
1. Tomcat:Tomcat是一个流行的开源Web服务器,支持Servlet和JSP规范。Spring Boot默认使用Tomcat作为内嵌容器。
2. Jetty:Jetty是另一个流行的开源Web服务器,支持Servlet规范。Spring Boot也可以使用Jetty作为内嵌容器。
3. Undertow:Undertow是一个轻量级的开源Web服务器,它的性能比Tomcat和Jetty更好。Spring Boot也可以使用Undertow作为内嵌容器。
可以通过配置文件修改默认的内嵌容器,例如:
```
# 使用Jetty作为内嵌容器
spring.main.web-application-type=none
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.servlet.TomcatServletWebServerFactoryAutoConfiguration
# 使用Undertow作为内嵌容器
spring.main.web-application-type=none
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.servlet.TomcatServletWebServerFactoryAutoConfiguration, org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.servlet.JettyServletWebServerFactoryAutoConfiguration
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.embedded.UndertowWebServerFactoryAutoConfiguration
```