Mapper.xml文件找不到
mybatis匹配不到xml文件的问题
·
新建工程并编写mybatis的**Mapper.xml,但是服务启动时,报错
Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
由错误知,是根据mapper接口中的方法找不到对应xml中的sql语句。
1. 检查mapper标签的namespace属性,是否正确。
2. 检查配置文件中mapperLocations是否指向了正确的位置。
3. 检查xxMapper.xml所在的目录名称。
例如,xml文件所在的目录为classpath:mapper/business/,
idea中显示的路径为mapper.business,
但是通过在资源管理器查看,发现目录名为“mapper.business”而非mapper/business二级目录。
通过重建目录,问题解决
更多推荐
已为社区贡献1条内容
所有评论(0)