public class PartitionDataSource
extends org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource
PartitionSeedContext 获取 PartitionSeed,再由 PartitionSeedToDataSourceKeyStrategy
转换成对应 DataSource 的 Lookup Key,再从 AbstractRoutingDataSource.resolvedDataSources 中动态选择数据源。| Constructor and Description |
|---|
PartitionDataSource(Map<String,DataSource> dataSources,
DataSource defaultDataSource,
PartitionSeedToDataSourceKeyStrategy partitionSeedToDataSourceKeyStrategy) |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
determineCurrentLookupKey() |
afterPropertiesSet, determineTargetDataSource, getConnection, getConnection, getResolvedDataSources, getResolvedDefaultDataSource, isWrapperFor, resolveSpecifiedDataSource, resolveSpecifiedLookupKey, setDataSourceLookup, setDefaultTargetDataSource, setLenientFallback, setTargetDataSources, unwrappublic PartitionDataSource(@Nonnull Map<String,DataSource> dataSources, @Nullable DataSource defaultDataSource, @Nonnull PartitionSeedToDataSourceKeyStrategy partitionSeedToDataSourceKeyStrategy)
protected Object determineCurrentLookupKey()
determineCurrentLookupKey in class org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSourceCopyright © 2017–2021. All rights reserved.