spring boot 配置外接tomcat
maven pom.xml配置:
<!-- 1.配置打包為war -->
<packaging>war</packaging>
<!-- 2.移除嵌入式tomcat外掛 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 移除嵌入式tomcat外掛 -->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- 3. 新增servlet依賴 外接tomcat-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- 4.設定 web.xml -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<!--如果想在沒有web.xml檔案的情況下構建WAR,請設定為false。-->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
2.啟動類繼承SpringBootServletInitializer實現configure
@SpringBootApplication
public class TestApplicationextends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder springApplicationBuilder) {
return springApplicationBuilder.sources(TestApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
}
相關文章
- spring boot(7) 配置外部tomcat(1)Spring BootTomcat
- Spring Boot:Spring Boot配置MybatisSpring BootMyBatis
- Spring Boot 學習系列(11)—tomcat引數配置建Spring BootTomcat
- Spring Boot & 配置Spring Boot
- Spring Boot:Spring Boot配置SwaggerSpring BootSwagger
- spring boot 部署到線上tomcatSpring BootTomcat
- SpringBoot外接TomcatSpring BootTomcat
- spring boot 配置 JPASpring Boot
- Spring Boot核心配置Spring Boot
- Spring Boot 內嵌容器 Tomcat / UndertowSpring BootTomcat
- Spring boot學習(二) Spring boot基礎配置Spring Boot
- Spring Boot學習筆記:Spring Boot核心配置Spring Boot筆記
- Spring Boot Security配置教程Spring Boot
- Spring Boot日誌配置Spring Boot
- Spring Boot 配置檔案Spring Boot
- Spring Boot中配置 AuditListenerSpring Boot
- 【Spring Boot】yaml配置注入Spring BootYAML
- Linux環境下Spring Boot專案內建Tomcat引數配置LinuxSpring BootTomcat
- Spring Boot專案部署到外部TomcatSpring BootTomcat
- Spring boot學習(九)Spring boot配置郵件傳送Spring Boot
- Spring boot學習(八)Spring boot配置ehcache快取框架Spring Boot快取框架
- Spring Boot 支援 JSP配置Spring BootJS
- 玩轉spring boot——properties配置Spring Boot
- Spring Boot 自動配置原理Spring Boot
- Spring Boot + Mybatis + Spring MVC環境配置(三):DataSource配置Spring BootMyBatisMVC
- Spring Boot —— Thymeleaf + Gradle run on Tomcat(war形式)Spring BootGradleTomcat
- Spring Boot + Mybatis + Spring MVC環境配置(二):Mybatis Generator配置Spring BootMyBatisMVC
- Spring Boot 配置 tess4jSpring Boot
- Spring Boot Reactor Netty配置 | BaeldungSpring BootReactNetty
- Spring Boot + MYSQL + Docker的配置 - DEVSpring BootMySqlDockerdev
- Spring Boot 配置介面 WebMvcConfigurerSpring BootWebMVC
- Spring Boot核心原理-自動配置Spring Boot
- spring boot配置檔案相關Spring Boot
- Spring Boot 配置檔案總結Spring Boot
- Spring Boot - Profile不同環境配置Spring Boot
- 使用Spring Boot整合Apollo配置中心Spring Boot
- Spring Boot配置類的註解Spring Boot
- Spring Boot中Tomcat是怎麼啟動的Spring BootTomcat