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

犯了一个低级错误,在网上找不到这个错误…

看到一个比较全的排错方法:https://blog.csdn.net/ppppfly/article/details/46847299/

错误部分代码:

public class StudentDaoImpl extends SqlSessionDaoSupport implements StudentMapper{

	@Override
	public void addStudent(Student student) {
		SqlSession session = super.getSqlSession() ;
		StudentMapper stuDao = session.getMapper(StudentDaoImpl.class) ;
		stuDao.addStudent(student);
	}   
}

正确做法:

public class StudentDaoImpl extends SqlSessionDaoSupport implements StudentMapper{

	@Override
	public void addStudent(Student student) {
		SqlSession session = super.getSqlSession() ;
		StudentMapper stuDao = session.getMapper(StudentMapper.class) ;
		stuDao.addStudent(student);
	}
     
}

getMapper里面我写的是StudentMapper的实现类StudentDaoImpl的class,所以错误。

你可能感兴趣的:(problems,Type,interface,xxx,is,not,known,to)