available: expected at least 1 bean which qualifies as autowire candidate

这个错误我也是找了半天,最后排查的时候发现是自己的实现类写错了,所以注入不进去.

出现这个错误一般有四个方向排查

  1. 查看接口实现类是否加入注解,如service、repository等
  2. 查看spring配置文件是否自动扫描包 <context:component-scan base-package=“xxx.xx.xxx”> 或者是否在自动包扫描之外
  3. 查看是否在web.xml中加载spring容器
  4. service是否有实现impl

更多推荐

available: expected at least 1 bean which qualifies as autowire candidate