在 Mybatis 中遇到的那些坑

1.报错信息:Invalid bound statement
原因:在 mybatis 配置中有如下两行代码
bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
bean.setMapperLocations(resolver.getResources("classpath:mapper/*/*.xml"));
是最后一条配置导致的问题,把
bean.setMapperLocations(resolver.getResources("classpath:mapper/*/*.xml"));
去掉就可以了。

2.报错信息:无效字符
mybatis 中的 .xml 查询,语句末尾,多了分号


猜你喜欢

转载自blog.csdn.net/ancdc/article/details/80647473