源码分析:Mybatis - @MapperScan

1
2
3
4
5
6
7
8
9
10
11
12
13
MyBatis - @MapperScan
MybatisPlusAutoConfiguration
--> AutoConfiguredMapperScannerRegistrar.registerBeanDefinitions
--> MapperScannerConfigurer.postProcessBeanDefinitionRegistry

ClassPathMapperScanner extends ClassPathBeanDefinitionScanner
-> scan -> doScan
-> super.doScan(basePackages);
-> processBeanDefinitions
-> definition.getConstructorArgumentValues().addGenericArgumentValue(Mapper.class);
-> definition.setBeanClass(MapperFactoryBean.class);
-> MapperFactoryBean.getObject()
---> return getSqlSession().getMapper(this.mapperInterface);