修改pom.xml

  1. <packaging>war</packaging>
  2. <dependency>
  3. <groupId>org.springframework.boot</groupId>
  4. <artifactId>spring-boot-starter-tomcat</artifactId>
  5. <scope>provided</scope>
  6. </dependency>
  7. <build>
  8. <finalName>${project.artifactId}</finalName>
  9. <plugins>
  10. <plugin>
  11. <groupId>org.apache.maven.plugins</groupId>
  12. <artifactId>maven-war-plugin</artifactId>
  13. <configuration>
  14. <failOnMissingWebXml>false</failOnMissingWebXml>
  15. </configuration>
  16. </plugin>
  17. </plugins>
  18. </build>

修改启动类

  1. @SpringBootApplication
  2. public class Application extends SpringBootServletInitializer {
  3. public static void main(String[] args) {
  4. SpringApplication.run(Application.class, args);
  5. }
  6. @Override
  7. protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
  8. return builder.sources(Application.class);
  9. }
  10. }