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类,否则会出现上述错误

原文地址:https://www.cnblogs.com/lmq-1048498039/p/6958554.html