FileDocCategorySizeDatePackage
ExceptionInterceptor.javaAPI DocExample577Mon Apr 25 07:58:20 BST 2005com.springbook.interceptors

ExceptionInterceptor.java

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());
     }


}