Spring Boot打包为war包
spring boot 默认是以jar包形式启动web程序
1.修改pom.xml
将
修改为:
2.新增如下到pom.xml文件中
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-tomcat</artifactId>
- <scope>provided</scope>
- </dependency>
3.新增ServletInitializer类
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(xxxApplication.class);
}