springboot如何构建war包

第一步 : 在dependencies中添加

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-tomcat</artifactid>
</dependency>

第二步 : 在启动类 Application 修改如下

@SpringBootApplicaton
public class Application extends SpringBootServletInitializer{

  @Override
  protected SpringApplicationBuilder configure(SpringApplic
ationBuilder builder){
    return builder.sources(HotDeployApplication.class);
  }

  publuc static void mai (String[] args){
    SpringApplication.run(HotDeployApplication.class, args);
  }
}