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

来源:5-5 实现注册超级管理员功能(Web层)

maomaoking

2021-01-20

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,

写回答

1回答

神思者

2021-01-20

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

0
1
maomaoking
加了@Mapper ,我调整了目录结构和在启动类加上了MapperScan(“sap路径”),就ok了
2021-01-20
共1条回复

SpringBoot 在线协同办公小程序开发 全栈式项目实战

未来趋势型业务 + 前后端综合技术栈 + 惊艳的细节打磨

1812 学习 · 1923 问题

查看课程