一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

Springboot如何切换默认的Tomcat容器 Springboot切换默认的Tomcat容器代码

时间:2020-06-18 编辑:袖梨 来源:一聚教程网

Springboot如何切换默认的Tomcat容器?本篇文章小编给大家分享一下Springboot切换默认的Tomcat容器代码,代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。

代码如下

    
      org.springframework.boot
      spring-boot-starter-web
      
        
          org.springframework.boot
          spring-boot-starter-tomcat
        
      
    
    
    
      org.springframework.boot
      spring-boot-starter-jetty
    

以上依赖就是将默认的tomcat切换为jetty容器

还可以切换为undertow

    
      org.springframework.boot
      spring-boot-starter-web
      
        
          org.springframework.boot
          spring-boot-starter-tomcat
        
      
    
 
 org.springframework.boot 
 spring-boot-starter-undertow 
 

如果这些容器都不满意 ,还可以切换为Netty

这里不引入starter-web,直接引入starter-webflux

    
      org.springframework.boot
      spring-boot-starter-webflux
    

这里注意spring-boot版本2.x才可以。

热门栏目