Spring AOP : Parameter passed as null for an interface with @Around aspect
I have a problem where I am using @Around in two interfaces that are
configured as Spring beans. One of those interface is a parameter to
another interface and is always getting passed as null value. Following is
the code snippet
public interface Interface1 {
public void method1();
}
public interface Interface2 {
public void method2(Interface1 param1);
}
@Around("execution(* Interface1.method1(..))")
private void interceptor1(ProceedingJoinPoint pJoinPoint) throws
Throwable{
//do something
}
@Around("execution(* Interface2.method2(..))")
private void interceptor2(ProceedingJoinPoint pJoinPoint) throws
Throwable{
//do something
}
In the calling code to Interface2 I always get the parameter param1 to
method2 as null. If I remove the @Around("execution(*
Interface1.method1(..))") above it works fine. The reason for adding the
@Around for both of them is to catch the Exceptions for logging and audit
purpose and to stop the rest of the exceptions to be propagated.
Can you please help me around this problem?
No comments:
Post a Comment