IntelliJ IDEA 新建spring boot 找不到@RestController 、@RequestMapping

缺少添加依赖。

1.在pom.xml 配置

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
import change 添加以上依赖之后 ,重新添加

2,如果方法1 还没有解决,可以手动导包

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

原文地址:https://www.cnblogs.com/Jackie-zhang/p/14452836.html