티스토리 뷰

Spring boot study

Spring boot AOP란?

dudwns3625 2021. 6. 1. 12:15
728x90
반응형
SMALL

AOP란?

AOP(Aspect Oriented Programming)

  • spring boot application 전체에걸쳐서 사용되는 기능을 재사용.
  • 핵심기능과 공통기능(Logging, Scheduler 등..) 을 분리시키는 방식

    1. Aspect

  • 분리할 부가적인 공통 기능을 모듈화

    2. Advice

  • Aspect의 구현체

    3. JointPoint

  • Advice를 적용할 부분
  • @Before
    • Method 실행 전에 동작
  • @After
    • Mothod 실행 후 동작
  • @Around
    • Method 실행 전 후 동작
  • @AfterReturning
    • Method 실행 후 동작(Method 반환값 반환)
  • @AfterThrowing
    • 예외가 발생했을 때 동작

      4. Pointcut

  • 실제로 Advice가 적용되는 부분(JointPoint의 상세 정보)

ex)

@Aspect
@Component
public class MyClass {
    @Around("execution(* com.aopTest.controller.*.*(..))")
    public void testAdvice() {
        .....
    }
}
728x90
반응형
LIST

'Spring boot study' 카테고리의 다른 글

JPA Auditing 정리  (0) 2020.11.27
댓글
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함