-
Notifications
You must be signed in to change notification settings - Fork 15
SpringConfigurations
GangCheng edited this page Jan 21, 2024
·
1 revision
-
The original
mybatis3
's configuration properties' namespace is move tor2dbc.mybaitis.xxxx
-
The
ConnectionFactory
's configuration is located in namespacespring.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
- The r2dbc auto-configuration is located in R2dbcMybatisAutoConfiguration
- If you want to customize
ConnectionFactory
, you should define a bean in spring environment which type is ConnectionFactoryOptionsCustomizer - If you want to customize
R2dbcMybatisConfiguration
, you should define a bean in spring environment which type is R2dbcMybatisConfigurationCustomizer
- 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
- Associated Concept
- Basic Operation Instruction
- Integration with Spring Framework