springboot警告:ApplicationContext is unlikely to start due to a @ComponentScan of the default package

1. 警告解读

** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
  • 1

如果你的springboot项目报了这个警告,那么你的项目会无法正常运行。

// 该警告解释为 : ApplicationContext 不能从一个组件的默认包启动
  • 1

2. 如何解决

既然他说该类不能从组件的默认包启动,那就给他建立一个包好了。

// 一般发出这个警告的原因是你把启动类直接放在的src目录下面。
// 你需要在src目录下面再建一个包,比如controlcenter,然后把启动类放到controlcenter下面。

猜你喜欢

转载自blog.csdn.net/m0_37450089/article/details/81176613