简单阅读code
简单阅读code记录
自己的随手记 单一个mybatis,版本3.5.3
MybatisSetUp.java
java
1 | String resource = "mybatis-config.xml"; |
获取SqlSessionFactory
解析配置文件
plaintext
1 | SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream,"mysql"); |
plaintext
1 |
|
构建org.apache.ibatis.session.Configuration
plaintext
1 | private void parseConfiguration(XNode root) { |
构建org.apache.ibatis.binding.MapperRegistry
plaintext
1 | mapperElement:362, XMLConfigBuilder (org.apache.ibatis.builder.xml) |
plaintext
1 | private void mapperElement(XNode parent) throws Exception { |
plugin
plaintext
1 | addInterceptor:37, InterceptorChain (org.apache.ibatis.plugin) |
plaintext
1 | private void pluginElement(XNode parent) throws Exception { |
初始化
plaintext
1 | <init>:40, Plugin (org.apache.ibatis.plugin) |
sqlSession=sqlSessionFactory.openSession();
关于plugin部分
调用到Plugin
plaintext
1 | invoke:61, Plugin (org.apache.ibatis.plugin) |
Plugin 反射 Intercept
plaintext
1 | intercept:27, ExamplePlugin (cn.demo.stdemo.plugin) |
获取mapper
plaintext
1 | newInstance:424, Constructor (java.lang.reflect) |
sql
plaintext
1 | parseStatementNode:57, XMLStatementBuilder (org.apache.ibatis.builder.xml) |
resultHandler
plaintext
1 | handleResult:43, DefaultResultHandler (org.apache.ibatis.executor.result) |