1.xml配置运行时没被读取到
2.mapper.xml没在mybatis主配置中注册3.UserMapper.xml数据错误
1.xml配置运行时没被读取到报错:
Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/CGL/Dao/UserDao.xml
解决方案:
maven中配置
src/main/java ***.xml true src/main/resources ***.xml true
maven由于他的约定大于配置,我们之后可能遇到我们写的配置文件,无法被导出或者生效
2.mapper.xml没在mybatis主配置中注册报错:
org.apache.ibatis.binding.BindingException: Type interface com.CGL.Dao.UserDao is not known to the MapperRegistry.
解决方案:
在mybatis主配置文件中加上
3.UserMapper.xml数据错误
select * from mybatis.myuser;



