MybatisAutoConfiguration
1、ConfigurationCustomizer 有什么用
2、configurationProperties (Externalized properties for MyBatis configuration) 用法
3、Interceptor[] interceptors 插件
4、typeHandlersPackage (Packages to search for type handlers.)用法
5、
MybatisAutoConfiguration
@bean 初始化SqlSessionFactory
SqlSessionFactory.getObject()
SqlSessionFactoryBean.buildSqlSessionFactory()方法,
- XmlConfigBuilder 解析configuration,并设置到Configuration中
- XMLMapperBuilder.parse() 解析mapper文件 **mapper.xml
- 获取调用Configuration.addMapper
- 初始化MapperProxyFactory
-
MapperAnnotationBuilder 解析 注解
-
- 初始化MapperProxyFactory
- 获取调用Configuration.addMapper
Configuration ->addMapper
MapperRegister ->addMappers
MapperProxyFactory ->newInstance
MapperProxy 实现了InvocationHandler
网友评论