SpringBoot simple project study notes 08 (switch built in the servlet container (tomcat, jetty, undertow))

  Source The following items will spread github, and now the project is still in the update, the update will upload completed projects

  On a summary is: SpringBoot three components (the servlet, FIlter, listener) https://www.cnblogs.com/zhaochunhui/p/11343963.html

  This section summarizes the switch is a three built servlet container (tomcat, jetty, undertow)

Default is built in the servlet tomcat, can be switched, then use other Jetty, undertow, but does not support the jsp undertow, more comfortable use Jetty (qq chat like on this in the case of long connections, can be long link)
 1 ), using the built-tomcat: 
in this case, when we create the project, import a web of dependence, it is used by default tomcat
 <dependency> 
<groupId> org.springframework.boot </ the groupId> 
<the artifactId> Starter-Spring-boot-web </ the artifactId> 
</ dependency> 
in this case, the default startup is Tomcat
 2 ), jetty switching 
order, then switched to the jetty, the introduced above is also dependent on the web to change,
 <the Dependencies> 
<-! is used by default Tomcat -> 
<-! modules introduced Web -> 
<dependency> 
<groupId> org.springframework.boot </ groupId> 
<artifactId> the Spring-boot- Web-Starter </ the artifactId> 
<Exclusions> 
<Exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</ Exclusion> 
</ Exclusions> 
</ dependency> 
<-! introduce other Servlet container (Jetty / the undertow) -> 
<dependency> 
<the artifactId> Starter-Spring-Boot-Jetty </ the artifactId> 
<the groupId> ORG .springframework.boot </ the groupId> 
</ dependency> 
in this case, the web is introduced which also rely on the beginning of the new content is added, and then set the jetty below, and then be activated when the see is the replacement jetty tomcat were started

 3 ), switch the undertow 
in order to switch to the undertow of words, dependent on the import of the above web should also change,
 <the Dependencies> 
<-! is used by default tomcat -> 
<! - - introduction of web module -> 
<dependency> 
<the groupId> org.springframework.boot </ the groupId> 
<the artifactId> Starter-Spring-Boot-web </ the artifactId> 
<Exclusions> 
<exclusion>
<the artifactId>spring-boot-starter-tomcat</artifactId>
<the groupId> org.springframework.boot </ the groupId> 
</ Exclusion> 
</ Exclusions> 
</ dependency> 
<-! introduce other Servlet container (Jetty / the undertow) -> 
<dependency> 
<the artifactId> Spring-Boot the undertow--starter </ the artifactId> 
<the groupId> org.springframework.boot </ the groupId> 
</ dependency> 
in this case, the web is introduced which also rely on the beginning of the new content is added, and then in the following jetty settings, and then start when you can see is the undertow replace tomcat were initiated 
changes when the console starts, you can see a very simple way to start a container of

 

Guess you like

Origin www.cnblogs.com/zhaochunhui/p/11344482.html