springboot test: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or

灰太狼 2023-10-05 17:02 92阅读 0赞

错误信息:

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

原因

因为自己修改了main下面的包名,导致test下面的包名跟main下面不一致,导致junit无法自动@Autowired DI注入

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3doNDQ1MzA2_size_16_color_FFFFFF_t_70

将红框中两个包名修改为一致,问题即可解决

发表评论

表情:
评论列表 (有 0 条评论,92人围观)

还没有评论,来说两句吧...

相关阅读