參閱:
MyBatis架構設計及源代碼分析系列(一):MyBatis架構
12.11
閱讀兩處源碼:
org.mybatis.spring.SqlSessionFactoryBean#buildSqlSessionFactory
XMLConfigBuilder, XMLMapperBuilder 組合起來構建 Configuration, 並構建Mapper。其中 statement的構建委託給了XMLStatementBuilder。
知識點:Builder模式。 組合模式。
org.apache.ibatis.builder.xml.XMLStatementBuilder#parseStatementNode
知識點:將相關對象封裝在Context(即一個XNode), 傳遞給XMLStatementBuilder來構建
JDK8用法:Optional.ofNullable(obj).isifPresent(method::reference)
待更新