Could not load TestContextBootstrapper [null]. Specify @BootstrapWith‘s ‘value‘ attribute...
在测试redis集成短信验证时使用test启动类做单元测试,使用了spring注入。
@RunWith(SpringRunner.class)
@SpringBootTest(classes = RbacApplication.class)
public class SmsUtilTest extends RbacApplicationTest{@Autowiredprivate SmsHelper smsHelper;@Autowiredprivate RedisHelper redisHelper;@Testpublic void testSms() throws InterruptedException {String tel = "158****9317";//存的是key_tel_code_1_18812145852String code = smsHelper.sendSmsCode(tel, 1);log.info("验证码:"+code);Thread.sleep(2000);}
}
启动后报错:
java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @BootstrapWith's 'value' attribute or make the default bootstrapper class available.
经查阅博客
https://blog.csdn.net/u013939884/article/details/70214093
https://blog.csdn.net/n_fly/article/details/78173385
发现是自己spring-test版本太高
<dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>5.3.6</version><scope>compile</scope>
</dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-test</artifactId>
</dependency>
改为
<dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><scope>compile</scope>
</dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-test</artifactId>
</dependency>
就能正常启动了
Could not load TestContextBootstrapper [null]. Specify @BootstrapWith‘s ‘value‘ attribute...相关推荐
- Spring Boot单元测试报错java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]
一:运行test类方法时候报错 报错 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. S ...
- 报错 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @Bootstra
由于我maven仓库之前已经有了有个5.0.10的test包 导致我的变量 <org.springframework.version>4.2.5.RELEASE</org.sprin ...
- Specify @BootstrapWith's 'value' attribute or make the default bootstrapper class available.
异常信息 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @Bootst ...
- 力扣报错runtime error: load of null pointer of type ‘int‘解决思路
记录本算法小白刷力扣的这道题遇到的报错 349. 两个数组的交集https://leetcode.cn/problems/intersection-of-two-arrays/ 出现报错的代码 /** ...
- Magento: 根据产品属性加载产品信息 Load A Category or Product by an Attribute
Load a Product by ID <?php// get product model by product id, assuming you have known product id, ...
- 项目中出现specify @BootstrapWith‘s ‘value‘ attribute or make the default bootstrapper class avail
问题描述:在启动项目的时候控制台中报以下错误 specify @BootstrapWith's 'value' attribute or make the default bootstrapper c ...
- spring boot:java.lang.IllegalStateException异常
1.单元测试报错: java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @B ...
- junit4 javaee 5.0 jpa SSH 单元测试问题集锦
http://blog.csdn.net/wuqilianga/article/details/51295787 本篇文章基于已经实现了ssh集成的demo.项目.具体的ssh项目怎么配置,请参考本文 ...
- mysql 变量is null 和 not exists区别
问题: 使用游标遍历时,发现使用 select var into tmp where var=? 然后判断if tmp is null时,不能走完所有的遍历.经debug发现, 当var为空时,则跳出 ...
最新文章
- 用jamon来监控你的sql执行效率
- Samrty技术的 初步了解
- 修改mysql数据库编码(5.7版本)
- 如何将矩阵化为约旦标准型_【解题方法】矩阵初等变换的应用
- r语言做绘制精美pcoa图_pca , nmds , pcoa 图添加分组的椭圆
- matlab的句柄 图形对象 gca gco gcf set get
- java 计算农历_java计算农历日期
- “贵人”相助,亚马逊云科技APN成员乘风破浪
- 关于微信公众号开发【微信JS-SDK】报错:config invalid url domian
- 机器人学——1.2-三维空间位姿描述
- 华为和荣耀的关系:亲兄弟,各自为王
- 软件工程实践Review
- Geoffrey Hinton:放弃反向传播,我们的人工智能需要重头再来
- codeforces 616F Expensive Strings
- python连接两个list
- 牛年贺岁特辑 | 盘点5G产业看趋势,喜迎牛年谋新局
- 字符串匹配------回顾大一时的一份代码
- Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[store_wa
- ubuntu上安装RobotFramework+ride
- 365天挑战LeetCode1000题——Day 096 消失的两个数字 子串能表示从 1 到 N 数字的二进制串 检查数组是否存在有效划分