Annotation Interface EnableMapper
@Inherited
@Documented
@Target(TYPE)
@Retention(RUNTIME)
@Import({JdbcConfiguration.class,MapperScannerRegistrar.class,MapperConfiguration.class})
public @interface EnableMapper
开启 Mybatis/Mapper
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends Annotation> 此属性指定扫描器将搜索的注释 扫描器将在基本包中注册所有同样具有指定注释的接口 注意,这可以与markerInterface结合使用Class<?>[]类型安全的替代basePackages()用于指定要扫描的包以查找带注释的组件,每个指定类的包将被扫描 考虑在每个包中创建一个特殊的无操作标记类或接口,它除了被该属性引用之外没有其他用途。String[]扫描MyBatis接口的基本包Class<? extends MapperFactoryBean> 指定一个自定义的MapperFactoryBean来返回一个mybatis代理作为spring bean还可以直接配置一个 MapperBuilder beanClass<?> 此属性指定扫描程序将搜索的父程序 扫描器将注册基包中所有同样具有指定接口类作为父类的接口 注意,这可以与annotationClass结合使用Class<? extends org.springframework.beans.factory.support.BeanNameGenerator> 用于命名Spring容器中检测到的组件的BeanNameGenerator类String[]通用 Mapper 的配置,一行一个配置指定在spring上下文中有多个SqlSessionFactory时使用哪个SqlSessionFactory通常只有当您有多个数据源时才需要这样做指定在spring上下文中有多个SqlSessionTemplate时使用哪个SqlSessionTemplate通常只有当您有多个数据源时才需要这样做String[]basePackages()属性的别名,与basePackages有相同效果
-
Element Details
-
value
String[] valuebasePackages()属性的别名,与basePackages有相同效果- Returns:
- the array
- Default:
{}
-
basePackages
String[] basePackages扫描MyBatis接口的基本包- Returns:
- the string
- Default:
{}
-
basePackageClasses
Class<?>[] basePackageClasses类型安全的替代basePackages()用于指定要扫描的包以查找带注释的组件,每个指定类的包将被扫描 考虑在每个包中创建一个特殊的无操作标记类或接口,它除了被该属性引用之外没有其他用途。- Returns:
- the class
- Default:
{}
-
nameGenerator
Class<? extends org.springframework.beans.factory.support.BeanNameGenerator> nameGenerator用于命名Spring容器中检测到的组件的BeanNameGenerator类- Returns:
- the class
- Default:
org.springframework.beans.factory.support.BeanNameGenerator.class
-
annotationClass
Class<? extends Annotation> annotationClass此属性指定扫描器将搜索的注释 扫描器将在基本包中注册所有同样具有指定注释的接口 注意,这可以与markerInterface结合使用- Returns:
- the class
- Default:
java.lang.annotation.Annotation.class
-
markerInterface
Class<?> markerInterface此属性指定扫描程序将搜索的父程序 扫描器将注册基包中所有同样具有指定接口类作为父类的接口 注意,这可以与annotationClass结合使用- Returns:
- the class
- Default:
java.lang.Class.class
-
sqlSessionTemplateRef
String sqlSessionTemplateRef指定在spring上下文中有多个SqlSessionTemplate时使用哪个SqlSessionTemplate通常只有当您有多个数据源时才需要这样做- Returns:
- the string
- Default:
""
-
sqlSessionFactoryRef
String sqlSessionFactoryRef指定在spring上下文中有多个SqlSessionFactory时使用哪个SqlSessionFactory通常只有当您有多个数据源时才需要这样做- Returns:
- the string
- Default:
""
-
factoryBean
Class<? extends MapperFactoryBean> factoryBean指定一个自定义的MapperFactoryBean来返回一个mybatis代理作为spring bean- Returns:
- the class
- Default:
org.miaixz.bus.starter.mapper.MapperFactoryBean.class
-
properties
String[] properties通用 Mapper 的配置,一行一个配置- Returns:
- the array
- Default:
{}
-
mapperBuilderRef
String mapperBuilderRef还可以直接配置一个 MapperBuilder bean- Returns:
- the string
- Default:
""
-