Interface MyBatisMapperScanRegistration


public interface MyBatisMapperScanRegistration
Registers mapper interfaces with the MyBatis Configuration of a datasource.

Implementations are generated by the micronaut-mybatis-processor for every MyBatisMapperScan and discovered through META-INF/services. They are applied by MyBatisFactory after all MyBatisConfigurationCustomizer beans.

Since:
7.3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    addMapper(org.apache.ibatis.session.Configuration configuration, Class<?> mapperType)
    Adds a mapper interface unless it is already known to the configuration.
    default void
    addMappers(org.apache.ibatis.session.Configuration configuration, String packageName)
    Adds all mapper interfaces of a package using MyBatis runtime scanning.
     
    void
    register(org.apache.ibatis.session.Configuration configuration)
    Registers the mapper interfaces.
  • Method Details

    • getDatasourceName

      String getDatasourceName()
      Returns:
      The name of the datasource whose configuration receives the mappers
    • register

      void register(org.apache.ibatis.session.Configuration configuration)
      Registers the mapper interfaces.
      Parameters:
      configuration - The MyBatis configuration
    • addMapper

      default void addMapper(org.apache.ibatis.session.Configuration configuration, Class<?> mapperType)
      Adds a mapper interface unless it is already known to the configuration.
      Parameters:
      configuration - The MyBatis configuration
      mapperType - The mapper interface
    • addMappers

      default void addMappers(org.apache.ibatis.session.Configuration configuration, String packageName)
      Adds all mapper interfaces of a package using MyBatis runtime scanning. This is the JVM fallback for packages in which the annotation processor could not discover any mapper interface. Unlike Configuration.addMappers(String), interfaces already known to the configuration (for example because they are also listed explicitly) are skipped.
      Parameters:
      configuration - The MyBatis configuration
      packageName - The package name