解决springboot启动报java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need

解决springboot启动报java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test

分析项目的目录结构,有没有启动类。

下面我拿我的项目举个例子

解决springboot启动报java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need

上图可知,我的启动类放错了位置,没有在包的根目录上。

解决springboot启动报java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need

再运行问题解决!!!