0
点赞
收藏
分享

微信扫一扫

Mybatis与JPA冲突报BindingException: Invalid bound statement (not found)

在同时使用Mybatis和JPA时,项目运行过程中会报如下问题:

InternalAuthenticationServiceException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.sancaiwulian.smes.system.service.mapper.UserMapper.toDto   at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:108)

无法绑定toDto方法

第一步先看target目录下生成的UserMapperImpl这个class
target
说明有这个toDto方法

原因分析

通过运行后Dubug看,发现userMapper被MybatisMapperProxy扫描到了。
在这里插入图片描述

解决方案:

@MapperScan("com.sancaiwulian.smes.**.mapper*")

重新再运行后的dubug效果为,我们发现userMapper这个bean指向的是UserMapperImpl的实现类了,不再是Mybatis的动态代理了:
在这里插入图片描述

举报

相关推荐

0 条评论