You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
섹션 13. 스프링 AOP - 실전 예제
1️⃣ 예제 만들기
✅ ExamRepository
✅ ExamTest
✅ ExamService
2️⃣ 로그 출력 AOP
✅ @trace
✅ TraceAspect
✅ ExamService
✅ ExamTest - 추가
@import(TraceAspect.class) 를 사용해서 TraceAspect 를 스프링 빈으로 추가하자. 이제 애스펙트가 적용된다.
실행 결과
3️⃣ 재시도 AOP
@Retry애노테이션이 있으면 예외가 발생했을 때 다시 시도해서 문제를 복구한다.✅@Retry
3을 사용한다.✅RetryAspect
@annotation(retry),Retry retry를 사용해서 어드바이스에 애노테이션을 파라미터로 전달한다.retry.value()를 통해서 애노테이션에 지정한 값을 가져올 수 있다.retry.value()만큼 재시도한다.✅ ExamRepository - @Retry 추가
@Import(TraceAspect.class)는 주석처리하고@Import({TraceAspect.class, RetryAspect.class})를 스프링 빈으로 추가하자.실행 결과
All reactions