springboot test: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or
错误信息:
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注入

将红框中两个包名修改为一致,问题即可解决
本文来自博客园,作者:IT情深,转载请注明原文链接:https://www.cnblogs.com/wh445306/p/16751723.html

浙公网安备 33010602011771号