티스토리 뷰
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 |
---|
댓글