运行代码出现这个报错,是因为配置pom.xml依赖包的时候,忘记了加入下面的依赖;把这个依赖加上后,再重新启动应用就可以了。

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>