我在执行方法时有一个AspectJ切入点,如下所示,当调用该方法时,我正在读取参数并对其进行验证。声明该方法的类为 Singleton 。我的问题是 joinPoint.getThis()和 joinPoint.getArgs()是线程安全的。
@Before("atExecution() && customPointcut(customAnnotation)")
public void validate(JoinPoint joinPoint, CustomAnnotation customAnnotation) {
MethodSignature sig = (MethodSignature) joinPoint.getSignature();
Method method = sig.getMethod();
ExecutableValidator execValidator = validator.forExecutables();
//is this code thread safe?
Set<ConstraintViolation<Object>> violations= execValidator.validateParameters(joinPoint.getThis(), method, joinPoint.getArgs());
}