码上敲享录 > SpringBoot常见问题详解 > you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

上一章章节目录下一章 2019-11-16已有98人阅读 评论(0)

springboot测试时Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test


解决方法:

那是因为@SpringBootTest中缺少classes属性配置,加上启动类的class即可,如下:

@RunWith(SpringRunner.class)

@SpringBootTest(classes = AdminApplication.class)


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
向大家推荐《Java面试进阶指南》:https://xiaozhuanlan.com/javainterview?rel=6923152725
向大家推荐《GIS之家》:https://xiaozhuanlan.com/gishome?rel=6923152725
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交