[英]UnsatisfiedDependencyException: Error creating bean with name 'accountController'
I've been following a tutorial video for web development using Spring
. 我一直在关注使用
Spring
进行Web开发的教程视频。
Here is the complete source code. 这是完整的源代码。
Following is the error I get when sending a GET
request to 以下是将
GET
请求发送到时出现的错误
localhost:8080/basic-web-app/rest/accounts
本地主机:8080 / basic-web-app / rest / accounts
https://drive.google.com/open?id=0B5FM3CiBT2VPYWM2MzRVUG9wSGM https://drive.google.com/open?id=0B5FM3CiBT2VPYWM2MzRVUG9wSGM
In file mvc-dispatcher-servlet.xml
you specified package for scan as: 在文件
mvc-dispatcher-servlet.xml
将要扫描的软件包指定为:
<context:component-scan base-package="app.rest.mvc"/>
But all services and repositories are placed in the package app.core
. 但是所有服务和存储库都放在
app.core
包中。 Because of this Spring can't find classes of services and does not instantiate service beans. 因此,Spring无法找到服务类,也无法实例化服务bean。 Just change package that have be to scanned for the next:
只需更改要扫描下一个程序包:
<context:component-scan base-package="app.rest.mvc, app.core"/>
Then Spring will find all components of the application. 然后,Spring将找到应用程序的所有组件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.