springBoot jar包 改为 war包 启动
一丶 新增maven 依赖,一级 build
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
二丶 新增 build
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<!--如果想在没有web.xml文件的情况下构建WAR,请设置为false。-->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
三丶 跟目录下,新增 FlowBootstrap 类
四丶 FlowBootStap类
@ServletComponentScan
public class FlowBootstrap extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
// 注意这里要指向原先用main方法执行的Application启动类
return builder.sources(FlowApplication.class);
}
}
五丶 FlowApplication启动类
@SpringBootApplication
@EnableTransactionManagement // 开启事务
@MapperScan("io.shulie.center.flow.core.mapper")
public class FlowApplication {
public static void main(String[] args) {
SpringApplication.run(FlowApplication.class, args);
}
}