目录
1.java.lang.ExceptionInInitializerError
2.Exception:Type interface com.bdqn.dao.UserDao is not known to the MapperRegistry.
1.java.lang.ExceptionInInitializerError
解决方法:在maven配置文件中导入
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*.properties</exclude>
<exclude>**/*.xml</exclude>
</excludes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
是导出资源失败的问题
2.Exception:Type interface com.bdqn.dao.UserDao is not known to the MapperRegistry.
解决方法:
<!-- 每一个mapper.xml都需要在Mybatis核心配置文件中注册!-->
<mappers>
<mapper resource="com/bdqn/dao/UserMapple.xml"></mapper>
</mappers>
一般Maven报错排错思路:
1.配置文件中没有配置
2.绑定接口错误
3.方法名不对
4.返回类型不对
5.maven导出资源问题