fix: 读写分离自定义分离策略不生效 close #I8FP0K

This commit is contained in:
开源海哥 2023-11-11 17:11:57 +08:00
parent 54afe053b2
commit 6ffd9cdab5
2 changed files with 8 additions and 1 deletions

View File

@ -98,6 +98,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-annotation</artifactId>
<version>1.7.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -70,7 +70,7 @@ public class MapperInvocationHandler implements InvocationHandler {
//最终通过数据源 自定义分片 策略去获取
String shardingDataSourceKey = DataSourceKey.getByShardingStrategy(dataSourceKey, proxy, method, args);
if (shardingDataSourceKey != null && !shardingDataSourceKey.equals(dataSourceKey)) {
DataSourceKey.use(dataSourceKey);
DataSourceKey.use(shardingDataSourceKey);
needClearDsKey = true;
}