我试图从AsyncUncaughtExceptionHandler的handleUncaughtException调用服务方法(以基于异常执行一些额外的操作)。但是似乎服务方法没有被调用。下面是实现。
public class CustomAsyncUncaughtExceptionHandler implements AsyncUncaughtExceptionHandler {
@Autowired
private AuditService auditService;
@Override
public void handleUncaughtException(final Throwable ex, final Method method, final Object... params) {
this.auditService.auditBasicException(ex.getMessage());
}
}
下面是记录在日志中的错误消息。
ERROR [executor-10] o.s.s.a.AnnotationAsyncExecutionInterceptor.handleError(AsyncExecutionAspectSupport.java:300) | Exception handler for async method '<method-name>' threw unexpected exception itself.
有指针吗?
谢谢, 拉胡尔