让main函数所在的启动类继承SpringBootServletInitializer并重写configure方法
return builder.sources(YourApplication.class);
加入tomcat依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>