在测试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...相关推荐

  1. Spring Boot单元测试报错java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]

    一:运行test类方法时候报错 报错 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. S ...

  2. 报错 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @Bootstra

    由于我maven仓库之前已经有了有个5.0.10的test包 导致我的变量 <org.springframework.version>4.2.5.RELEASE</org.sprin ...

  3. Specify @BootstrapWith's 'value' attribute or make the default bootstrapper class available.

    异常信息 java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @Bootst ...

  4. 力扣报错runtime error: load of null pointer of type ‘int‘解决思路

    记录本算法小白刷力扣的这道题遇到的报错 349. 两个数组的交集https://leetcode.cn/problems/intersection-of-two-arrays/ 出现报错的代码 /** ...

  5. 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, ...

  6. 项目中出现specify @BootstrapWith‘s ‘value‘ attribute or make the default bootstrapper class avail

    问题描述:在启动项目的时候控制台中报以下错误 specify @BootstrapWith's 'value' attribute or make the default bootstrapper c ...

  7. spring boot:java.lang.IllegalStateException异常

    1.单元测试报错: java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]. Specify @B ...

  8. junit4 javaee 5.0 jpa SSH 单元测试问题集锦

    http://blog.csdn.net/wuqilianga/article/details/51295787 本篇文章基于已经实现了ssh集成的demo.项目.具体的ssh项目怎么配置,请参考本文 ...

  9. mysql 变量is null 和 not exists区别

    问题: 使用游标遍历时,发现使用 select var into tmp where var=? 然后判断if tmp is null时,不能走完所有的遍历.经debug发现, 当var为空时,则跳出 ...

最新文章

  1. 用jamon来监控你的sql执行效率
  2. Samrty技术的 初步了解
  3. 修改mysql数据库编码(5.7版本)
  4. 如何将矩阵化为约旦标准型_【解题方法】矩阵初等变换的应用
  5. r语言做绘制精美pcoa图_pca , nmds , pcoa 图添加分组的椭圆
  6. matlab的句柄 图形对象 gca gco gcf set get
  7. java 计算农历_java计算农历日期
  8. “贵人”相助,亚马逊云科技APN成员乘风破浪
  9. 关于微信公众号开发【微信JS-SDK】报错:config invalid url domian
  10. 机器人学——1.2-三维空间位姿描述
  11. 华为和荣耀的关系:亲兄弟,各自为王
  12. 软件工程实践Review
  13. Geoffrey Hinton:放弃反向传播,我们的人工智能需要重头再来
  14. codeforces 616F Expensive Strings
  15. python连接两个list
  16. 牛年贺岁特辑 | 盘点5G产业看趋势,喜迎牛年谋新局
  17. 字符串匹配------回顾大一时的一份代码
  18. Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[store_wa
  19. ubuntu上安装RobotFramework+ride
  20. 365天挑战LeetCode1000题——Day 096 消失的两个数字 子串能表示从 1 到 N 数字的二进制串 检查数组是否存在有效划分

热门文章

  1. CentOS7开发环境搭建(1)
  2. 喜欢爱C/C++的人不要浮躁
  3. 快速上手,使用 Kotlin 把支付宝小程序装进自己的 App
  4. 分享实录 | 企业CICD规模化落地浅析
  5. 规范白盒生态 S³IP助力未来可预期服务网络
  6. 我竟然混进了 Python 高级圈子!
  7. 牛!Python 全栈必备的 150 个实战案例,一次性获得!
  8. 详解异构计算FPGA基础知识
  9. 双十一提前预热,这款耳机直降80元!
  10. 上云难?TA霸气回应:不要你觉得,一键上云 so easy!