springboottest报红
时间: 2023-09-08 08:13:29 浏览: 186
Springboot测试
在使用@SpringBootTest注解时,如果该注解报红,可能是因为没有导入相应的测试包或者依赖。可以根据以下几个引用内容的建议进行排查和解决问题。
首先,确保已经导入了测试包org.springframework.boot:spring-boot-starter-test,并且该依赖的scope设置为test。这可以通过在pom.xml文件中添加以下依赖来实现:<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *3* [Cannot resolve symbol ‘SpringBootTest‘ 注解报红问题解决方案](https://blog.csdn.net/u014160286/article/details/115191913)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* [@SpringBootTest 注解报红解决办法](https://blog.csdn.net/qq_39759664/article/details/113699827)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文