1、前言
上一篇我们解了Mybatis解析器模块,本篇我们来了解反射模块。本文,我们来分享 MyBatis 的异常模块。
对应 exceptions
包,如下图所示:
在 MyBatis源码分析(二):项目结构 中,简单介绍了这个模块:
定义了 MyBatis 专有的 PersistenceException 和 TooManyResultsException 异常。
实际上,MyBatis 不仅仅在 exceptions
包下有异常,在其他包下也有异常,整体如下类图:
2、源码分析
2.1、exceptions
包
2.1.1 IbatisException
org.apache.ibatis.exceptions.IbatisException
,实现 RuntimeException 类,IBatis 的异常基类。代码如下: