Tomcat,Jetty,Undertow 作为三大主流 Servelt 容器,Undertow 的性能要优于前两者。在相同资源使用量的情况下 undertow 比 tomcat 有更好的吞吐量和较低的访问时延。SpringBoot 默认使用 Tomcat 作为内嵌容器,但也提供了快捷的方式集成 Undertow 容器。
集成 Undertow 服务器
添加 Maven 依赖
在引入 spring-boot-starter-web
依赖时,剔除出对 tomcat
的依赖,然后再添加对 undertow
的依赖用于替换 tomcat
。
<dependencies>
<dependency>
<groupId>org.spri