解决org.apache.ibatis.binding.BindingException: Type interface XXX is not known to the MapperRegistry

笔者在做mybatis的一个例子的时候,出现了下面这一个报错

org.apache.ibatis.binding.BindingException: Type interface com.myBatis.dao.AccountDao is not known to the MapperRegistry.

	at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:47)
	at org.apache.ibatis.session.Configuration.getMapper(Configuration.java:745)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:292)
	at com.itheima.test.MybatisMutiTableTest.before(MybatisMutiTableTest,java:30) <23 internal calls>


Process finished with exit code -1

报错原因:

  • 核心配置文件 MyBatis.xml 里映射器配置文件路径没有写正确

**解决办法:**将mappers里的路径名称修改正确即可

	<!--映射器配置文件-->
    <mappers>
        <mapper resource="com/myBatis/dao/AccountDao.xml"/>
    </mappers>

你可能感兴趣的:(mybatis,java,xml)