ダイコン時代の設計手法 - 例外処理

(ひがやすおの日記より)
なるほど、AOPでばっちりですね!
さっそく書き直しました。ちょっとだけAOP脳が発達したような気がします。

// 例外ハンドリングインターセプタ
public class ThrowsLoggingInterceptor extends ThrowsInterceptor {
  private static final Log log = LogFactory.getLog(ThrowsLoggingInterceptor.cla

  // Throwableはロギング
  public void handleThrowable(Throwable t, MethodInvocation invocation) throws Throwable {
    log.error(t.getMessage(), t);
    throw t;
  }

  // キャンセル例外はロギングの必要なし
  public void handleThrowable(CancelRuntimeException e, MethodInvocation invocation) throws Throwable {
    throw e;
  }
}
設定ファイル

  例外ハンドリングインターセプタ



  throwsLoggingInterceptor
  サービスクラス

追記:ロギング後の再throwが抜けていました。