public class ExceptionAdvice extends ThrowsInterceptor { private static final Log log = LogFactory.getLog(ExceptionAdvice.class); public void handleThrowable(Throwable t, MethodInvocation invocation) throws Throwable { // 例外処理 log.error("Exception class[" + invocation.getThis().getClass().getName() + "]: method[" + invocation.getMethod().getName() + "]:" + t); throw t; } }
<!-- EmployeeManager --> <componentclass="jp.co.thinkit.employee.business.EmployeeManagerImpl"> <aspect>managerAop</aspect> </component> <!-- EmployeeManager用のAOP --> <component name="managerAop" class="org.seasar.framework.aop.interceptors.InterceptorChain"> <initMethod name="add"><arg>j2ee.requiredTx</arg></initMethod> <initMethod name="add"><arg>exceptionAdvice</arg></initMethod> <initMethod name="add"><arg>traceInterceptor</arg></initMethod> </component> <component name="exceptionAdvice" class="jp.co.thinkit.employee.aop.ExceptionAdvice"/> <component name="traceInterceptor" class="org.seasar.framework.aop.interceptors.TraceInterceptor"/>