maven相关修改
<packaging>war</packaging>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
启动类:继承SpringBootServletInitializer 重写configure
@SpringBootApplication
public class Web01Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Web01Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//传入SpringBoot应用的主程序
return application.sources(Web01Application.class);
}
}