一、使用注解@MapperScan开始
org.mybatis.spring.annotation.MapperScan
org.mybatis.spring.annotation.MapperScannerRegistrar
org.springframework.context.annotation.ImportBeanDefinitionRegistrar
registerBeanDefinitions
二、注册mapper声明的接口的回调入口 loadBeanDefinitionsFromRegistrars
org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader
←loadBeanDefinitionsForConfigurationClass←loadBeanDefinitions
org.springframework.context.annotation.ConfigurationClassPostProcessor
←postProcessBeanDefinitionRegistry或postProcessBeanFactory
(回调)
org.springframework.context.annotation.AnnotationConfigUtils
←registerAnnotationConfigProcessors
org.springframework.context.annotation.AnnotatedBeanDefinitionReader
←AnnotatedBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry, org.springframework.core.env.Environment)
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
←getAnnotatedBeanDefinitionReader←loadBeanDefinitions
←org.springframework.context.support.AbstractRefreshableApplicationContext#loadBeanDefinitions
org.springframework.context.support.AbstractApplicationContext
←refreshBeanFactory←obtainFreshBeanFactory←refresh
原文:https://www.cnblogs.com/windlog/p/13629610.html