启动zst项目时报错:bean注入失败—InstituteForZstService

在启动zst项目的时候,一直报错,最终的问题其实就是说这个:InstituteForZstService的bean注入失败

它是在有一个service中注入了这个,但是为什么注入不成功?

@Autowired
private InstituteForZstService instituteForZstService;
1.查看接口实现类是否加入注解,如service、repository等。

2.查看spring配置文件是否自动扫描包

  <context:component-scan base-package="xxx.xx.xxx">

3.查看是否在web.xml中加载spring容器。

开始一直没有注意到,是实现类有没有注解,点进去看,service存在,再看实现类有没有注解。。

结果发现这个接口没有实现类,问题所在,可以暂时加一个实现类并添加注解@Service("InstituteForZstService")

发布了98 篇原创文章 · 获赞 9 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/liucai1018/article/details/103778015