Springboot2.X之切換使用Servlet容器Jetty、Tomcat、Undertow
1、配置
1.1 pom配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
如果使用Jetty容器,那麼添加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
如果使用Undertow容器,那麼添加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency
2、切換Servlet容器
2.1 版本2.0以下,1.X的版本切換Jetty、Undertow
在啟動類,添加
@Bean
public EmbeddedServletContainerFactory servletContainer() {
JettyEmbeddedServletContainerFactory factory =
new JettyEmbeddedServletContainerFactory();
return factory;
}
如果你想換成Undertow,那麼把上面中Jetty五個字母替換成Undertow
2.2 版本2.0以上,2.X版本切換Jetty、Undertow
在啟動類添加
@Bean public ServletWebServerFactory servletContainer() {
JettyServletWebServerFactory tomcat = new JettyServletWebServerFactory();
return tomcat;
}
如果你想換成Undertow,那麼把上面中Jetty五個字母替換成Undertow
※使用KETTLE從mysql同步增量數據到oracle
※TypeScript基礎之高級類型的可辨識聯合(Discriminated Unions)
TAG:程序員小新人學習 |