Class ClassPathR2dbcMapperScanner

java.lang.Object
org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
org.springframework.context.annotation.ClassPathBeanDefinitionScanner
pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.mapper.ClassPathR2dbcMapperScanner
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ResourceLoaderAware, org.springframework.core.env.EnvironmentCapable

public class ClassPathR2dbcMapperScanner 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.

copy form original ClassPathR2dbcMapperScanner

Since:
1.2.0
Author:
Hunter Presnall, Eduardo Macarron
See Also:
  • Field Summary

    Fields inherited from class org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClassPathR2dbcMapperScanner(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    protected boolean
    isCandidateComponent(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition beanDefinition)
    void
    Configures parent scanner to search for the right interfaces.
    void
    setAnnotationClass(Class<? extends Annotation> annotationClass)
     
    void
    setDefaultScope(String defaultScope)
    Set the default scope of scanned mappers.
    void
    setLazyInitialization(boolean lazyInitialization)
    Set whether enable lazy initialization for mapper bean.
    void
    setMapperFactoryBeanClass(Class<? extends R2dbcMapperFactoryBean> mapperFactoryBeanClass)
    Set the MapperFactoryBean class.
    void
    setMarkerInterface(Class<?> markerInterface)
     
    void
     
    void
    setSqlSessionFactoryBeanName(String sqlSessionFactoryBeanName)
     

    Methods inherited from class org.springframework.context.annotation.ClassPathBeanDefinitionScanner

    getBeanDefinitionDefaults, getRegistry, isCompatible, postProcessBeanDefinition, registerBeanDefinition, scan, setAutowireCandidatePatterns, setBeanDefinitionDefaults, setBeanNameGenerator, setIncludeAnnotationConfig, setScopedProxyMode, setScopeMetadataResolver

    Methods inherited from class org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider

    addExcludeFilter, addIncludeFilter, clearCache, findCandidateComponents, getEnvironment, getMetadataReaderFactory, getResourceLoader, isCandidateComponent, registerDefaultFilters, resetFilters, resolveBasePackage, setEnvironment, setMetadataReaderFactory, setResourceLoader, setResourcePattern

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ClassPathR2dbcMapperScanner

      public ClassPathR2dbcMapperScanner(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
  • Method Details

    • setAnnotationClass

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

      public void setLazyInitialization(boolean lazyInitialization)
      Set whether enable lazy initialization for mapper bean.

      Default is false.

      Parameters:
      lazyInitialization - Set the @{code true} to enable
      Since:
      2.0.2
    • setMarkerInterface

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

      public void setSqlSessionFactory(ReactiveSqlSessionFactory sqlSessionFactory)
    • setSqlSessionFactoryBeanName

      public void setSqlSessionFactoryBeanName(String sqlSessionFactoryBeanName)
    • setMapperFactoryBeanClass

      public void setMapperFactoryBeanClass(Class<? extends R2dbcMapperFactoryBean> mapperFactoryBeanClass)
      Set the MapperFactoryBean class.
      Parameters:
      mapperFactoryBeanClass - the MapperFactoryBean class
      Since:
      2.0.1
    • setDefaultScope

      public void setDefaultScope(String defaultScope)
      Set the default scope of scanned mappers.

      Default is null (equiv to singleton).

      Parameters:
      defaultScope - the scope
      Since:
      2.0.6
    • 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
      Overrides:
      doScan in class org.springframework.context.annotation.ClassPathBeanDefinitionScanner
    • isCandidateComponent

      protected boolean isCandidateComponent(org.springframework.beans.factory.annotation.AnnotatedBeanDefinition beanDefinition)
      Overrides:
      isCandidateComponent in class org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider
    • checkCandidate

      protected boolean checkCandidate(String beanName, org.springframework.beans.factory.config.BeanDefinition beanDefinition)
      Overrides:
      checkCandidate in class org.springframework.context.annotation.ClassPathBeanDefinitionScanner