-
绑定异常
org.apache.ibatis.binding.BindingException: Type interface com.alivin.dao.UserDao is not known to the MapperRegistry.
<!--每一个 Mapper.xml 都需要在 mybatis 核心配置文件中注册-->
-
java.lang.ExceptionInInitializerError
在build中配置 resource,来防止资源导出失败的问题
<!--maven的资源过滤问题-->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
-
可能遇到的问题
- 配置文件没有注册
- 绑定接口错误
- 方法名不对
- 返回类型不对
- Maven 导出资源问题