类 ClassPathMapperScanner

  • 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.context.ResourceLoaderAware, org.springframework.core.env.EnvironmentCapable

    public class ClassPathMapperScanner
    extends org.springframework.context.annotation.ClassPathBeanDefinitionScanner
    A ClassPathBeanDefinitionScanner that registers Mappers by basePackage, annotationClass, or markerInterface. If an annotationClass and/or markerInterface is specified, only the specified types will be searched (searching for all interfaces will be disabled).

    This functionality was previously a private class of MapperScannerConfigurer, but was broken out in version 1.2.0.

    从以下版本开始:
    1.2.0
    作者:
    Hunter Presnall, Eduardo Macarron
    另请参阅:
    MapperFactoryBean
    • 字段概要

      • 从类继承的字段 org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider

        logger
    • 构造器概要

      构造器 
      构造器 说明
      ClassPathMapperScanner​(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)  
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      protected boolean checkCandidate​(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
      Set<org.springframework.beans.factory.config.BeanDefinitionHolder> doScan​(String... basePackages)
      Calls the parent search that will search and register all the candidates.
      tk.mybatis.mapper.mapperhelper.MapperHelper getMapperHelper()  
      protected boolean isCandidateComponent​(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition beanDefinition)
      void registerFilters()
      Configures parent scanner to search for the right interfaces.
      void setAddToConfig​(boolean addToConfig)  
      void setAnnotationClass​(Class<? extends Annotation> annotationClass)  
      void setConfig​(tk.mybatis.mapper.entity.Config config)
      配置通用 Mapper
      void setMapperFactoryBean​(MapperFactoryBean<?> mapperFactoryBean)  
      void setMapperHelper​(tk.mybatis.mapper.mapperhelper.MapperHelper mapperHelper)  
      void setMapperHelperBeanName​(String mapperHelperBeanName)  
      void setMapperProperties​(String[] properties)
      从 properties 数组获取 mapper 配置信息
      void setMapperProperties​(org.springframework.core.env.Environment environment)
      从环境变量中获取 mapper 配置信息
      void setMarkerInterface​(Class<?> markerInterface)  
      void setSqlSessionFactory​(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)  
      void setSqlSessionFactoryBeanName​(String sqlSessionFactoryBeanName)  
      void setSqlSessionTemplate​(org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate)  
      void setSqlSessionTemplateBeanName​(String sqlSessionTemplateBeanName)  
      • 从类继承的方法 org.springframework.context.annotation.ClassPathBeanDefinitionScanner

        getBeanDefinitionDefaults, getRegistry, isCompatible, postProcessBeanDefinition, registerBeanDefinition, scan, setAutowireCandidatePatterns, setBeanDefinitionDefaults, setBeanNameGenerator, setIncludeAnnotationConfig, setScopedProxyMode, setScopeMetadataResolver
      • 从类继承的方法 org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider

        addExcludeFilter, addIncludeFilter, clearCache, findCandidateComponents, getEnvironment, getMetadataReaderFactory, getResourceLoader, isCandidateComponent, registerDefaultFilters, resetFilters, resolveBasePackage, setEnvironment, setMetadataReaderFactory, setResourceLoader, setResourcePattern
    • 构造器详细资料

      • ClassPathMapperScanner

        public ClassPathMapperScanner​(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
    • 方法详细资料

      • registerFilters

        public void registerFilters()
        Configures parent scanner to search for the right interfaces. It can search for all interfaces or just for those that extends a markerInterface or/and those annotated with the annotationClass
      • doScan

        public Set<org.springframework.beans.factory.config.BeanDefinitionHolder> doScan​(String... basePackages)
        Calls the parent search that will search and register all the candidates. Then the registered objects are post processed to set them as MapperFactoryBeans
        覆盖:
        doScan 在类中 org.springframework.context.annotation.ClassPathBeanDefinitionScanner
      • isCandidateComponent

        protected boolean isCandidateComponent​(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition beanDefinition)
        覆盖:
        isCandidateComponent 在类中 org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
      • checkCandidate

        protected boolean checkCandidate​(String beanName,
                                         org.springframework.beans.factory.config.BeanDefinition beanDefinition)
        覆盖:
        checkCandidate 在类中 org.springframework.context.annotation.ClassPathBeanDefinitionScanner
      • getMapperHelper

        public tk.mybatis.mapper.mapperhelper.MapperHelper getMapperHelper()
      • setMapperHelper

        public void setMapperHelper​(tk.mybatis.mapper.mapperhelper.MapperHelper mapperHelper)
      • setAddToConfig

        public void setAddToConfig​(boolean addToConfig)
      • setAnnotationClass

        public void setAnnotationClass​(Class<? extends Annotation> annotationClass)
      • setConfig

        public void setConfig​(tk.mybatis.mapper.entity.Config config)
        配置通用 Mapper
        参数:
        config -
      • setMapperFactoryBean

        public void setMapperFactoryBean​(MapperFactoryBean<?> mapperFactoryBean)
      • setMapperHelperBeanName

        public void setMapperHelperBeanName​(String mapperHelperBeanName)
      • setMapperProperties

        public void setMapperProperties​(org.springframework.core.env.Environment environment)
        从环境变量中获取 mapper 配置信息
        参数:
        environment -
      • setMapperProperties

        public void setMapperProperties​(String[] properties)
        从 properties 数组获取 mapper 配置信息
        参数:
        properties -
      • setMarkerInterface

        public void setMarkerInterface​(Class<?> markerInterface)
      • setSqlSessionFactory

        public void setSqlSessionFactory​(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
      • setSqlSessionFactoryBeanName

        public void setSqlSessionFactoryBeanName​(String sqlSessionFactoryBeanName)
      • setSqlSessionTemplate

        public void setSqlSessionTemplate​(org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate)
      • setSqlSessionTemplateBeanName

        public void setSqlSessionTemplateBeanName​(String sqlSessionTemplateBeanName)