Annotation Type R2dbcMapperScan
-
@Retention(RUNTIME) @Target(TYPE) @Documented @Import(R2dbcMapperScannerRegistrar.class) @Repeatable(R2dbcMapperScans.class) public @interface R2dbcMapperScan
Use this annotation to register MyBatis mapper interfaces when using Java Config. It performs when same work asR2dbcMapperScannerConfigurerviaMapperScannerRegistrar.Either
basePackageClasses()orbasePackages()(or its aliasvalue()) may be specified to define specific packages to scan. Since 2.0.4, If specific packages are not defined, scanning will occur from the package of the class that declares this annotation. copy from original MapperScan- Since:
- 1.2.0
- Author:
- Michael Lanyon, Eduardo Macarron
- See Also:
R2dbcMapperScannerRegistrar,R2dbcMapperFactoryBean
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Class<? extends Annotation>annotationClassThis property specifies the annotation that the scanner will search for.Class<?>[]basePackageClassesType-safe alternative tobasePackages()for specifying the packages to scan for annotated components.String[]basePackagesBase packages to scan for MyBatis interfaces.StringdefaultScopeSpecifies the default scope of scanned mappers.Class<? extends R2dbcMapperFactoryBean>factoryBeanSpecifies a custom R2dbcMapperFactoryBean to return a mybatis proxy as spring bean.StringlazyInitializationWhether enable lazy initialization of mapper bean.Class<?>markerInterfaceThis property specifies the parent that the scanner will search for.Class<? extends org.springframework.beans.factory.support.BeanNameGenerator>nameGeneratorTheBeanNameGeneratorclass to be used for naming detected components within the Spring container.StringsqlSessionFactoryRefSpecifies whichReactiveSqlSessionFactoryto use in the case that there is more than one in the spring context.String[]valueAlias for thebasePackages()attribute.
-
-
-
Element Detail
-
value
@AliasFor("basePackages") String[] valueAlias for thebasePackages()attribute. Allows for more concise annotation declarations e.g.:@MapperScan("org.my.pkg")instead of@MapperScan(basePackages = "org.my.pkg")}.- Returns:
- base package names
- Default:
- {}
-
-
-
basePackages
@AliasFor("value") String[] basePackagesBase packages to scan for MyBatis interfaces. Note that only interfaces with at least one method will be registered; concrete classes will be ignored.- Returns:
- base package names for scanning mapper interface
- Default:
- {}
-
-
-
basePackageClasses
Class<?>[] basePackageClasses
Type-safe alternative tobasePackages()for specifying the packages to scan for annotated components. The package of each class specified will be scanned.Consider creating a special no-op marker class or interface in each package that serves no purpose other than being referenced by this attribute.
- Returns:
- classes that indicate base package for scanning mapper interface
- Default:
- {}
-
-
-
nameGenerator
Class<? extends org.springframework.beans.factory.support.BeanNameGenerator> nameGenerator
TheBeanNameGeneratorclass to be used for naming detected components within the Spring container.- Returns:
- the class of
BeanNameGenerator
- Default:
- org.springframework.beans.factory.support.BeanNameGenerator.class
-
-
-
annotationClass
Class<? extends Annotation> annotationClass
This property specifies the annotation that the scanner will search for.The scanner will register all interfaces in the base package that also have the specified annotation.
Note this can be combined with markerInterface.
- Returns:
- the annotation that the scanner will search for
- Default:
- java.lang.annotation.Annotation.class
-
-
-
markerInterface
Class<?> markerInterface
This property specifies the parent that the scanner will search for.The scanner will register all interfaces in the base package that also have the specified interface class as a parent.
Note this can be combined with annotationClass.
- Returns:
- the parent that the scanner will search for
- Default:
- java.lang.Class.class
-
-
-
sqlSessionFactoryRef
String sqlSessionFactoryRef
Specifies whichReactiveSqlSessionFactoryto use in the case that there is more than one in the spring context. Usually this is only needed when you have more than one datasource.- Returns:
- the bean name of
ReactiveSqlSessionFactory
- Default:
- ""
-
-
-
factoryBean
Class<? extends R2dbcMapperFactoryBean> factoryBean
Specifies a custom R2dbcMapperFactoryBean to return a mybatis proxy as spring bean.- Returns:
- the class of
R2dbcMapperFactoryBean
- Default:
- pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.mapper.R2dbcMapperFactoryBean.class
-
-
-
lazyInitialization
String lazyInitialization
Whether enable lazy initialization of mapper bean.Default is
false.- Returns:
- set
trueto enable lazy initialization - Since:
- 2.0.2
- Default:
- ""
-
-
-
defaultScope
String defaultScope
Specifies the default scope of scanned mappers.Default is
""(equiv to singleton).- Returns:
- the default scope
- Default:
- ""
-
-