1.在pom.xml里插入如下代码:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
2.选中项目,右键找到Maven 点击Reimport 更新依赖包。
3.在File里点击Invalidate And Restart 重启下。
4.重启后的编辑器按alt+enter自动导入,或手动引入
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;