use of org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint in project cuba by cuba-platform.
the class ServiceInterceptor method getValidateServiceMethodContext.
@Nullable
protected ValidateServiceMethodContext getValidateServiceMethodContext(ProceedingJoinPoint ctx) {
ValidateServiceMethodContext validatedContext = null;
if (ctx instanceof MethodInvocationProceedingJoinPoint) {
MethodInvocationProceedingJoinPoint methodInvocationCtx = (MethodInvocationProceedingJoinPoint) ctx;
Method method = ((MethodSignature) ctx.getSignature()).getMethod();
Validated validated = getValidated(method, ctx.getSignature().getDeclaringType());
if (validated != null) {
Object[] args = methodInvocationCtx.getArgs();
ExecutableValidator validator = beanValidation.getValidator().forExecutables();
validatedContext = new ValidateServiceMethodContext(validator, ctx.getThis(), method, args, validated.value());
}
}
return validatedContext;
}
use of org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint in project new-cloud by xie-summer.
the class GenericAnnotationAroundAspect method before.
public void before(ProceedingJoinPoint pjp) {
if (pjp instanceof MethodInvocationProceedingJoinPoint) {
MethodInvocationProceedingJoinPoint mpjp = (MethodInvocationProceedingJoinPoint) pjp;
MethodSignature methodSignature = (MethodSignature) mpjp.getSignature();
// 获取当前的切面方法
Method method = methodSignature.getMethod();
DynamicDataSourceHolders.putDataSource(null);
Class target = mpjp.getTarget().getClass();
boolean collectResult = collectResult(target, method);
if (collectResult) {
log.debug("{}方法{}数据源代理到{}", Thread.currentThread(), method.getName(), DynamicDataSourceHolders.getDataSource());
} else {
log.debug("{}方法{}无数据源代理注解", Thread.currentThread(), method.getName());
}
}
}
Aggregations