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_第1张图片

启动后报错:

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context_第2张图片

由于在测试类中没有指定@SpringBootConfiguration的类,所以@SpringBootTest注解无法找到@SpringBootConfiguration类,从而引发了这个异常。为了解决这个问题,你需要在@SpringBootTest注解中指定你的Spring Boot应用的主启动类。例如:

java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @Context_第3张图片

你可能感兴趣的:(java,开发语言)