前提条件:已配置了SpringBoot打成War包
不添添加Servlet依赖报: SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer

添加Servlet-api依赖

<!-- 不添加该依赖tomcat7:run无法运行项目 -->
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>

添加插件

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <port>8080</port>
        <path>/</path>
        <uriEncoding>utf-8</uriEncoding>
    </configuration>
</plugin>

相关文章:

  • 2022-12-23
  • 2021-11-28
  • 2022-01-16
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
猜你喜欢
  • 2021-04-05
  • 2021-09-28
  • 2021-11-19
  • 2021-07-28
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案