java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration

简介: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration

springboot单元测试时报错:

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


解决办法:



测试类要和SpringBoot的主类在同一个目录下,也就是com.ihrm.company这个包下,不然就报错

目录
相关文章
|
7月前
|
Java Spring
【Java】Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
【Java】Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
90 0
|
jenkins Java 持续交付
maven 打包项目报Fatal Error: Unable to find package java.lang in classpath or bootclasspat
maven 打包项目报Fatal Error: Unable to find package java.lang in classpath or bootclasspat
maven 打包项目报Fatal Error: Unable to find package java.lang in classpath or bootclasspat
|
3月前
|
Java Linux iOS开发
8 种 Java- 内存溢出之五 -Unable to create new native thread
8 种 Java- 内存溢出之五 -Unable to create new native thread
|
8月前
|
SQL 关系型数据库 MySQL
Hive报错:HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.me
Hive报错:HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.me
152 0
|
5月前
|
存储 Java
Java【报错 01】Unable to open nested jar file 问题说明及解决方法(仅针对压缩工具 WinRAR)
Java【报错 01】Unable to open nested jar file 问题说明及解决方法(仅针对压缩工具 WinRAR)
167 0
|
7月前
|
Java
【Java异常】ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JDWP exit erro
【Java异常】ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JDWP exit erro
77 0
|
9月前
|
缓存 NoSQL Redis
java.io.IOException: java.lang.RuntimeException: unable to find class for code 253
原因: 跟踪了一下所调用的底层接口,发现是redis缓存的问题,登录redis,刷新redis
46 0
|
9月前
|
Java 测试技术
java.lang.IllegalStateException Unable to find a @SpringBootConfiguration代码报错
java.lang.IllegalStateException Unable to find a @SpringBootConfiguration代码报错
|
Java Android开发
安卓解决java.lang.RuntimeException: Unable to get provider com.blankj.utilcode.util.Utils$FileProvider
安卓解决java.lang.RuntimeException: Unable to get provider com.blankj.utilcode.util.Utils$FileProvider
1534 0
|
Java Maven
maven报错 java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector,
maven报错 java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector,
maven报错 java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector,