java 多数据源切换时,支持类注解
1,在切点增加 @whtiin 类的注解扫描
@Pointcut("@annotation(DS) || @within(DS) ")
@After("@annotation(DS) || @within(DS)")
2优先试用方法注解生数据源的,如果没有在使用类的
if (methodDs != null) {
// 取出注解中的数据源名
dataSource = methodDs.value();
}else if (classDS != null) {
// 若方法上没有 @DS 注解,且类上有 @DS 注解,则使用类注解中的数据源名
dataSource = classDS.value();
}

浙公网安备 33010602011771号