org.apache.ibatis.parsing
使用XPath(XPathParser)进行xml解析,GenericTokenParser解析${} 格式的字符
org.apache.ibatis.logging
Log、LogFactory使用适配器模式,通过jdk动态代理的方式,将jdbc操作通过指定的日志框架打印出来
org.apache.ibatis.reflection
Reflector
org.apache.ibatis.cache
Cache接口定义了缓存的基本行为,使用装饰器模式,
impl下的 PerpetualCache 存储的是一级缓存
在 BaseExecutor.query() 方法中,会根据 <select>
标签的 flushCache 和 Configuration 的 localCacheScope 决定是否清空一级缓存;
在update() 方法中,负责执行 insert、update、delete这三类语句也会清空缓存。
- mybatis-config.xml 中配置 cacheEnabled,默认值为true
- mapper.xml 中配置了 节点会根据 namespace 创建相应的Cache对象, 节点不会创建独立的 Cache对象,它和指定的 namespace共享同一个。
<select>
节点中的 useCache属性,查询的结果会保存到二级缓存中。useCache默认值为true。
org.apache.ibatis.type
TypeHandler、TypeHandlerRegistry 实现 java 和 jdbc 类型的转换
org.apache.ibatis.io
通过 VFS 扫描资源
org.apache.ibatis.datasource
DataSourceFactory工厂接口,两类DataSource:PooledDataSource(有缓存)、UnPooledDataSource
org.apache.ibatis.transaction
TransactionFactory
org.apache.ibatis.binding
保存mapper信息
org.apache.ibatis.builder.xml
XMLConfigBuilder、XMLMapperBuilder等
org.apache.ibatis.executor.parameter
ParameterHandler
org.apache.ibatis.mapping
SqlSource
org.apache.ibatis.executor.BaseExecutor
org.apache.ibatis.executor.statement
StatementHandler
org.apache.ibatis.executor.resultSet
ResultSetHandler
org.apache.ibatis.executor.plugin
SqlSession
org.apache.ibatis.session
SqlSessionFactory