参考了很多文章,
具体的步骤如下:
1、springboot默认是打jar包,我们需要改成war包
2、pom.xml增加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
3、增加一个初始化的类
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class Initializer extends SpringBootServletInitializer {
@Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application){
return application.sources(项目application.class);
}
}
4、可以打包了
5、部署到tomcat下就可以了