package com.springbook.interceptors;
import org.springframework.aop.ThrowsAdvice;
import java.lang.reflect.Method;
public class ExceptionInterceptor implements ThrowsAdvice {
public void afterThrowing(Method m, Object[] args,
Object target, Exception ex) {
System.out.println("Call to method " + m.getName() +
" on class " + target.getClass().getName() +
" resulted in exception of type " + ex.getClass().getName());
System.out.println("Exception message: " + ex.getMessage());
}
}
|