Annotation Interface MyBatisMapperScan


@Documented @Retention(RUNTIME) @Target(TYPE) public @interface MyBatisMapperScan
Requests compile-time discovery of MyBatis mapper interfaces.

The micronaut-mybatis-processor generates a MyBatisMapperScanRegistration for every annotated type. The registration adds the mapper interfaces found in value() and listed in mappers() to the MyBatis Configuration of the datasource() without runtime classpath scanning, which makes the registration work in GraalVM native images.

The annotation can be placed on any type, it does not have to be a bean. Only mapper interfaces compiled together with the annotated type are discovered by package; mapper interfaces from other modules must be listed in mappers().

Since:
7.3.0
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
    Class<?>[]
     
    boolean
    Whether to generate the GraalVM native image metadata (dynamic proxy entries for the mapper interfaces and reflection entries for their result and parameter types), using the same mechanism as @ReflectiveAccess.
     
  • Element Details

    • value

      String[] value
      Returns:
      Packages containing MyBatis mapper interfaces. Sub-packages and nested interfaces are included.
      Default:
      {}
    • datasource

      String datasource
      Returns:
      The datasource name to which the discovered mappers are registered
      Default:
      "default"
    • mappers

      Class<?>[] mappers
      Returns:
      Mapper interfaces to register directly
      Default:
      {}
    • nativeImageMetadata

      boolean nativeImageMetadata
      Whether to generate the GraalVM native image metadata (dynamic proxy entries for the mapper interfaces and reflection entries for their result and parameter types), using the same mechanism as @ReflectiveAccess. The metadata is ignored on the JVM, so it only needs to be disabled when a project wants to manage the native image configuration itself.
      Returns:
      Whether to generate GraalVM native image metadata
      Default:
      true