类 DynamicDatasourceNamedInterceptor
java.lang.Object
com.baomidou.dynamic.datasource.aop.DynamicDatasourceNamedInterceptor
- 所有已实现的接口:
org.aopalliance.aop.Advice,org.aopalliance.intercept.Interceptor,org.aopalliance.intercept.MethodInterceptor
public class DynamicDatasourceNamedInterceptor
extends Object
implements org.aopalliance.intercept.MethodInterceptor
Named Interceptor of Dynamic Datasource
- 从以下版本开始:
- 3.4.0
- 作者:
- TaoYu
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddPattern(String methodName, String dsKey) add Item PatternvoidaddPatternMap(Map<String, String> map) add PatternMapvoidfromProperties(Properties properties) config from propertiesinvoke(org.aopalliance.intercept.MethodInvocation invocation)
-
构造器详细资料
-
DynamicDatasourceNamedInterceptor
init- 参数:
dsProcessor- dsProcessor
-
-
方法详细资料
-
invoke
@Nullable public Object invoke(@Nonnull org.aopalliance.intercept.MethodInvocation invocation) throws Throwable - 指定者:
invoke在接口中org.aopalliance.intercept.MethodInterceptor- 抛出:
Throwable
-
addPattern
add Item Pattern- 参数:
methodName- like select*dsKey- like master or slave
-
addPatternMap
add PatternMap- 参数:
map- namedMap
-
fromProperties
config from propertiesProperties attributes = new Properties(); attributes.setProperty("select*", "slave"); attributes.setProperty("add*", "master"); attributes.setProperty("update*", "master"); attributes.setProperty("delete*", "master");- 参数:
properties- ds properties
-