出现这种问题是因为缺少web依赖,加入如下依赖便可解决。
1 <dependency> 2 <groupId>org.springframework.boot</groupId> 3 <artifactId>spring-boot-starter-web</artifactId> 4 </dependency>