dawdler-server-plug-db
Module Introduction
Server-side transaction module, providing a transaction manager and a transaction usage essentially consistent with spring, and supporting read/write splitting. (It generally does not need to be referenced separately; it is referenced as a dependency by the mybatis or dao modules.)
1. Add the dependency to pom
<groupId>club.dawdler</groupId>
<artifactId>dawdler-server-plug-db</artifactId>
2. services-conf.xml transaction configuration file description
services-conf.xml is the core configuration file on the server side; it includes data source definitions, binding data sources to specified target packages, read/write splitting configuration, and server configuration.
The transaction-related configuration in this module is as follows:
<datasource-expressions>
<datasource-expression id="order-datasource"
latent-expression="write=[user_writeDataSource],read=[user_readDataSource|user_readDataSource1]" /><!--
Data source expression configuration; id is the identifier and latent_expression is the read/write configuration, where write is the write connection and read is the read connection. Multiple read connections can be configured separated by |
and are called in round-robin fashion -->
</datasource-expressions>
<decisions>
<!-- mapping: the service package that needs the data source injected; latent-expression: the id in the data source expression configuration -->
<decision mapping="com.dawdler.order.service.impl"
latent-expression-id="order-datasource" />
</decisions>