Spring boot启动失败:Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
问题
Springboot 项目启动失败,报错如下:
Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
(由于默认包的@ComponentScan,您的ApplicationContext不太可能启动)
排查
我们查看入口函数,并没有ComponentScan标签,所以猜测为默认入口函数位置与默认扫描位置没有对应上导致。
所以,我们查看pom文件以及入口函数的位置:
- pom文件:
- 入口函数位置
很显然,我们的路径与pom文件的路径不一致,此时已经有了解决方案。
解决
很简单,重新创建package,与pom文件一致即可:
修改后,成功运行!