我有以下课程。
@Inherited
@InterceptorBinding
@Retention(RUNTIME)
@Target({ TYPE, METHOD })
public @interface MyLogger {
public boolean skipParams() default true;
}
@MyLogger
@Interceptor
public class MyInterceptor {
@AroundInvoke
public Object logMethod(InvocationContext joinPoint) throws Exception {
// Some log statements here
}
}
public class MyClass {
@MyLogger()
void test1(){
// some code
}
@MyLogger(skipParams = true)
void test2(){
// some code
}
@MyLogger(skipParams = false)
void test3(){
// some code
}
}
@AroundInvoke在提供属性时不起作用。 为test1()调用logMethod(),但不为test2()和test3()调用。