错误o.s.b.d.LoggingFailureAnalysisReporter和Invalid bound statement (not found)

o.s.b.d.LoggingFailureAnalysisReporter
第一:
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.

Description:
Field employeeDao in com.jun.managementsystem.controller.EmployeeController required a bean of type ‘com.jun.managementsystem.dao.EmployeeDao’ 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.jun.managementsystem.dao.EmployeeDao’ in your configuration.

大概的意思是@Autowired注解没有注解成功,因为它没有找到相关类型的bean,@Autowired注入是type类型注入的,是我自己忘记在dao层或者mapper层没有添加组件注解@Repository或者@Component也可以,但最好使用@Repository。

如果是控制层或者业务层则是@Controller或者@Service.

Invalid bound statement (not found)
第二:映射配置错误,mapper文件扫描不到或者信息错误
这个错误主要是漏了某点或者忘记写错字母等引起的,错误原因多种多样,但都集中在配置mapper.xml文件和路径上。

检查namespace是否正确
dao层与配置xml文件是否对应
resultType是否用了别名却没设置(我就是忘记了这点)
resultMap是否一一对应
最后则是mapper的XML配置路径是否正确,特别是文件创建的坑,要一个一个创建,用点的话其实是一个目录,可以去项目代码位置查看一下是否正确。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值