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;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM