mybatis使用接口方式报错

报错:org.apache.ibatis.binding.BindingException: Type interface com.lmq.inter.MybatisBeanDao is not known to the MapperRegistry

原因:没有在xml文件中设置namesace和接口的全类名一致

MybatisBean.xml

<mapper namespace="com.lmq.inter.MybatisBeanDao">
<select id="selectMybatisTestByID" parameterType="int" resultType="MybatisBean">
select * from mybatistest where id = #{id}
</select>
</mapper>

 

则,对应的接口类必须是com.lmq.inter包下的MybatisBeanDao类,否则会出现上述错误

 

posted on 2017-06-07 18:35  玄门主宰  阅读(402)  评论(0编辑  收藏  举报

导航