解决报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.tuniu.dao.

解决报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.tuniu.dao.

意思是没有找到com.tuniu.dao.CategoryDao.findAll

这种情况,一般都是配置文件出了问题,配置映射不对.

看了一下SqlMapConfig.xml中的配置

解决报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.tuniu.dao.

我这边记录一下解决的办法

解决报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.tuniu.dao.

解决报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.tuniu.dao.

最后发现是单词写错了

CategoryDao的Dao接口

写成了

CategotyDao.xml的xml配置文件.

Dao接口与xml配置文件不对应,所以使用自动配置说找不到.

解决报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.tuniu.dao.

CategoryDao对应,则运行成功!!!

这里顺便说一下配置mapper映射的两种方法

第一种(单个配置)

解决报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.tuniu.dao.

但显然过于麻烦

第二种(扫包)推荐使用

解决报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):com.tuniu.dao.