- 在启动类bootApplication类同级目录新建。。。。
public class SpringBootStartApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
// 注意这里要指向原先用main方法执行的Application启动类
return builder.sources(ScisApplication.class);
}
}
- 添加servlet依赖
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
- 注释tomcat依赖
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!-- </dependency>-->
- 修改Pom.xml的jar 为 war
<groupId>com.jcohy</groupId>
<artifactId>scis</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
- 执行package
如图:将在target目录生成一个war包