解决java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use异常问题

解决java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use异常问题

image-20220531203622653

我碰到的问题:

写一个springboot Demo时在运行单元测试的时候报异常java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use

问题排查:

忘记写springboot启动类

补充

这个异常除了忘记写启动类 还有一个可能会引起这个异常

启动类和单元测试类要放在同一级别目录下

image-20220531204458427

posted @ 2022-05-31 20:46  乱起的名字  阅读(137)  评论(0)    收藏  举报