Skip to content

SpringConfigurations

GangCheng edited this page Jan 21, 2024 · 1 revision

Configuration properties

  • The original mybatis3's configuration properties' namespace is move to r2dbc.mybaitis.xxxx

  • The ConnectionFactory 's configuration is located in namespace spring.r2dbc.mybatis.xxxx

  • The mybatis-r2dbc configuration properties --> R2dbcMybatisProperties

  • The ConnectionFactory configuration properties --> R2dbcMybatisConnectionFactoryProperties

  • Sample configuration yaml:

    r2dbc:
      mybatis:
        mapper-locations: classpath:mapper/**/*.xml
        configuration-properties:
          "MySQL": "mysql"
          "MariaDB": "mariadb"
          "PostgreSQL": "postgresql"
          "[Microsoft SQL Server]": "mssql"
          "[Oracle Database]": "oracle"
        configuration:
          map-underscore-to-camel-case: true
    spring:
      r2dbc:
        mybatis:
          r2dbc-url: xxxxx
          username: username
          password: password
          pool:
            max-idle-time: PT3M
            initial-size: 3
            max-size: 16
            acquire-retry: 3
            validation-depth: REMOTE
            max-create-connection-time: PT30S

Auto Configuration

Mapper Scan

  • The original @MapperScan is replaced with @R2dbcMapperScan
  • The original @MapperScans is replaced with @R2dbcMapperScans
  • Mapped method can be annotated with @Repository as well. Related Test