请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

代码和老师的一样,运行如下(课程5-5)

00:28:01 WARN Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userController’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userServiceImpl’: Unsatisfied dependency expressed through field ‘userDao’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.example.emos.wx.db.dao.TbUserDao’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
00:28:01 INFO Stopping service [Tomcat]
00:28:01 INFO

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
00:28:01 ERROR


APPLICATION FAILED TO START


Description:

Field userDao in com.example.emos.wx.service.impl.UserServiceImpl required a bean of type ‘com.example.emos.wx.db.dao.TbUserDao’ that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type ‘com.example.emos.wx.db.dao.TbUserDao’ in your configuration.

Process finished with exit code 1

网上很多说是要注入@Mapper,

正在回答 回答被采纳积分+3

1回答

神思者 2021-01-20 08:19:58

视频里讲了要给dao加mapper注解,你回看一下视频

0 回复 有任何疑惑可以回复我~
  • 提问者 maomaoking #1
    加了@Mapper ,我调整了目录结构和在启动类加上了MapperScan(“sap路径”),就ok了
    回复 有任何疑惑可以回复我~ 2021-01-20 08:49:27
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信