Error when you start zst project: bean injection failed -InstituteForZstService

Start zst project, has been given, in fact, that this ultimate question: InstituteForZstService of bean injection failure

It is injected at a service in this, but why inject unsuccessful?

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

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

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

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

Start has not noticed, is the implementation class notes there is no point to go see, service there is, look at the implementation class have no comment. .

It was found that this class does not implement the interface, the problem, you can temporarily add an implementation class and annotate @Service ( "InstituteForZstService")

Published 98 original articles · won praise 9 · views 50000 +

Guess you like

Origin blog.csdn.net/liucai1018/article/details/103778015