Skip to content

Commit

Permalink
FEAT(#1) :: After-Throwing Advice 등록
Browse files Browse the repository at this point in the history
- 예외 발생 시 동작
  • Loading branch information
mic050r committed Oct 2, 2024
1 parent 3022f68 commit 27673d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions AOP/src/main/java/org/example/advice/AspectClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ public void afterReturning(Object returnValue) {
System.out.println("정상 종료 후 메서드");
System.out.println("Return value: " + returnValue);
}

// After-Throwing Advice: 메서드 실행 중 예외가 발생했을 때 실행되는 로직
public void afterThrowing(Throwable e) {
System.out.println("예외 발생 메서드");
System.out.println("e : " + e);
}
}
3 changes: 3 additions & 0 deletions AOP/src/main/resources/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

<!-- After-Returning Advice 등록: 메서드가 정상적으로 종료된 후에 실행 -->
<aop:after-returning method="afterReturning" pointcut-ref="point" returning="returnValue"/>

<!-- After-Throwing Advice 등록: 메서드 실행 중 예외가 발생할 때 실행 -->
<aop:after-throwing method="afterThrowing" pointcut-ref="point" throwing="e"/>
</aop:aspect>
</aop:config>

Expand Down

0 comments on commit 27673d9

Please sign in to comment.