首页 > 编程语言 >java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context

时间:2022-12-31 11:04:36浏览次数:60  
标签:lang use java spring RestTemplate Unable need find


在使用RestTemplate时,写了一个测试测试方法,遇到了这个报错。
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test

解决办法

确定下你的项目是不是spring环境下的,项目能不能正常通过main方法启动。

​在spring环境下和非spring环境下,使用RestTemplate​


标签:lang,use,java,spring,RestTemplate,Unable,need,find
From: https://blog.51cto.com/u_15295225/5982022

相关文章