Exception in thread "main" org.apache.ibatis.binding.BindingException: Type interface com.test.bean.groupMapper is not known to the MapperRegistry.

时间:2024-01-05 19:40:26
Exception in thread "main" org.apache.ibatis.binding.BindingException: Type interface com.test.bean.groupMapper 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)

解决办法,逆工程没有添加对应的映射包路径,加好就可以了,mybatis.xml中添加

  <!-- 映射文件方式1,一个一个的配置
<mapper resource="cn/thinknovo/pojo/UserMapper.xml"/>-->
<!-- 映射文件方式2,自动扫描包内的Mapper接口与配置文件 -->
<package name="com/test/pojo"/>
<package name="com/test/bean"/>