写了一个单元测试test来启动activiti,controller放在src/main/java根目录下,test对应也放在src/test/java下,结果报错: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test at or…
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.118 sec <<< FAILURE! - in com.example.demo.RosApplicationTestsinitializationError(com.example.demo.RosApplicationTests)  Time elapsed: 0.01 sec  <<< ERROR!java.lang.Illega…
springboot测试启动报错: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test 解决:注意springboot启动类Application要和测试类在同一级包下…
报错 java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test ...... ...... ...... ...... ...... ...... ...... 我当时运行SpringBoot测试类的时候踩这个坑,当时的解决办法就是,原…
application.class要放在根目录下,否则会发生以下错误…
解决方案一: 将测试类的包路径改为和主启动类的一致 解决方法二: 不想改测试类的路径 就在测试类上添加要测试的类的classes…
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your testat org.springframework.util.Assert.state(Assert.java:70)at org.springframework.boot.test.c…
完整异常: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test 无法找到@SpringBootConfiguration,您需要在测试中使用@ContextConfiguration或@SpringBootTest(classes=-) 问题产生的几种情况: 1.启动类 或者 程序入口类的包名和…
问题描述:java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=-) with your test 问题截图: 出现原因:在进行单元测试时我太懒了,随便建了个test包就进行测试,导致出现这个问题解决方案:将包名改为与其他分支一样的路径.就可以了!如下图: 然后再执行就可…