优化数据源注解查找逻辑,支持目标类和声明类的组合检查
parent
725c7dcea2
commit
f2a0580c3e
|
|
@ -67,6 +67,15 @@ public class DataSourceAspect
|
||||||
return dataSource;
|
return dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class);
|
// 组合检查声明类和目标类
|
||||||
}
|
Class<?> declaringType = signature.getDeclaringType();
|
||||||
}
|
Class<?> targetClass = point.getTarget().getClass();
|
||||||
|
|
||||||
|
DataSource classAnnotation = AnnotationUtils.findAnnotation(targetClass, DataSource.class);
|
||||||
|
if (classAnnotation == null) {
|
||||||
|
classAnnotation = AnnotationUtils.findAnnotation(declaringType, DataSource.class);
|
||||||
|
}
|
||||||
|
return classAnnotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue