Because individuals have encountered this problem, check online version will be changed to say that the majority of 1.4.2.RELEASE.
So wrote the following manner hereby give more friend in need is another solution.
1. First, the start of this class inherits SpringBootServletInitializer abstract class, which configure and implement methods, as follows:
/**
* 项目启动类
*
* @author Tom
* @date 2019-11-16
*/
@SpringBootApplication
public class BusinessApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(BusinessApplication.class, args);
}
/**
* 1.项目使用jsp页面需要将启动类添加如下方法
* 2.启动类需要继承SpringBootServletInitializer并重写其configure方法
* 2.然后将pom文件改为<packaging>war</packaging>
* 3.项目正常打包mvn clean package 生成war包
* 4.用java -jar 执行你的war包即可
*/
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(BusinessApplication.class);
}
2. Then pom file read war:
<packaging>war</packaging>
Add packaged plug-ins:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!--热部署-->
<configuration>
<fork>true</fork>
</configuration>
</plugin>
3. Item Normal packing mvn clean package generation packet war
Use eclipse the implementation of their idea or a packaging not elaborated here.