1 首先得在本地跑通.
2 处理启动类Application
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
}
注 : 部署到tomcat上必须要继承SpringBootServletInitializer类,并重写configure方法
3 pom.xml中 <packaging>war</packaging> -设置成war
4 打war包
5 target文件夹下面就有war包了
6 复制war放到tomcat下的webapps文件夹即可 , 启动tomcat他会加载你的war包生成一个文件夹,这就是你的项目了