我有一个界面
@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD, ElementType.TYPE })
public @interface LoggingInterceptorBinding {
}
和一个班级:
@LoggingInterceptorBinding
@Interceptor
public class LoggingInterceptor implements Serializable {
@AroundInvoke
public Object onMethodCall(InvocationContext context) throws Exception {
try {
System.out.println("Log before Method");
return context.proceed();
} finally {
System.out.println("Log after Method");
}
}
和一个带注释的方法:
@LoggingInterceptorBinding
public void sayHello(String name)
是否可以在拦截器“onMethodCalls”方法中从 sayHello 中获取参数“name”?