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

两种解决方式:

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

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

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

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

这里写图片描述

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