首页 > 解决方案 > AspectJ 不适用于实现 AsyncUncaughtExceptionHandler 的类

问题描述

我有以下课程:

@Component
public class AsyncExceptionHandler implements AsyncUncaughtExceptionHandler {

    @Override
    public void handleUncaughtException(Throwable ex, Method method, Object... params) {
        System.out.println("Error handling!"); 
    }
}

我有以下方面:

@Before("execution(* org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler.handleUncaughtException(java.lang.Throwable, java.lang.reflect.Method, java.lang.Object...)) && "
        + "args(ex, method, params) && target(myapplication.exception.handler.AsyncExceptionHandler)")
public void asyncExceptionHandlerHandleUncaughtExceptionBefore(Throwable ex, Method method, Object... params) {
    System.out.println("Aspect OK!"); 
}

由于登录我的应用程序的标准方式,我需要这个方面。今天,这类方面有很多方面正在发挥作用!只有这方面是行不通的!

问题:

  1. 我想不可能拦截 AsyncUncaughtExceptionHandler 实现(拦截器)。就是它?
  2. 与 varags 相关的东西params

标签: javaaopaspectj

解决方案


推荐阅读