外置tomcat部署SpringBoot项目

一、main方法所在Class修改为一下配置

 

代码:

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(DemoApplication.class);
}

二、修改pom.xml文件

  1. 外部tomcat配置
  2. 修改
<!--外置tomcat启动-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>
<packaging>war</packaging>
原文地址:https://www.cnblogs.com/2070393244com/p/12877240.html