两种解决方式:

1、以Application方式启动,在pom中把tomcat的scope改为compile

 <!-- tomcat 的支持.-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>compile</scope>
        </dependency>


2、以spring-boot:run(maven方式)方式启动工程
(IDEA工具)

Run–》Edit Configurations–》+—》选择Maven–》配置命令为spring-boot:run
右上角选择启动方式

1、点击右上角的Add configuration

springboot Failed to introspect annotated methods on class org.springframework.boot.web.support.Spri

2、按照下图配置

springboot Failed to introspect annotated methods on class org.springframework.boot.web.support.Spri

3、点击 run

springboot Failed to introspect annotated methods on class org.springframework.boot.web.support.Spri
=========================================================
下面说一下主要造成原因,因为我们直接运行application类,而我们的servlet-api等依赖tomcat的库的scope为provide,所以我们的tomcat的scope需要改为compile
以spring-boot:run方式启动相当于直接部署工程到tomcat中,所以tomcat的scope为provide也不会影响

相关文章:

  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2021-09-16
猜你喜欢
  • 2021-09-04
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案