1、pom文件添加命令
<!--springboot打war包,编译时候依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
<build> <finalName>${project.artifactId}</finalName> <plugins> <!--springboot打war包--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins></build>
2、修改启动类,添加重写方法
public class SeckillApplication extends SpringBootServletInitializer{ public static void main(String[] args) { SpringApplication.run(SeckillApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(SeckillApplication.class); } }
原文地址:https://www.cnblogs.com/gaorj/p/8463981.html
时间: 2024-10-31 16:30:11