mybatis加载mapper接口过程

spring中mybatis加载mapper接口过程

一、使用注解@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

posted @ 2020-09-07 22:21  windlog  阅读(301)  评论(0编辑  收藏  举报