org.apache.ibatis.binding.BindingException: Type interface com.dao.UserDAO is not known to the MapperRegistry.
at org
.apache
.ibatis
.binding
.MapperRegistry
.getMapper(MapperRegistry
.java
:36)
at org
.apache
.ibatis
.session
.Configuration
.getMapper(Configuration
.java
:536)
at org
.apache
.ibatis
.session
.defaults
.DefaultSqlSession
.getMapper(DefaultSqlSession
.java
:215)
at com
.util
.MybatisUtil
.getMapper(MybatisUtil
.java
:30)
at com
.service
.impl
.UserServiceImpl
.login(UserServiceImpl
.java
:18)
at com
.test
.TestService
.testLogin(TestService
.java
:18)
at sun
.reflect
.NativeMethodAccessorImpl
.invoke0(Native Method
)
at sun
.reflect
.NativeMethodAccessorImpl
.invoke(NativeMethodAccessorImpl
.java
:62)
at sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl
.java
:43)
at java
.lang
.reflect
.Method
.invoke(Method
.java
:498)
出现这个错误的主要原因是由于mapper映射文件的namespace和接口的名字不一致 如图所示 :