스프링AOP
-
스프링 AOP: @AOPSPRING/스프링프레임워크 핵심개념 2021. 5. 29. 17:12
Spring AOP를 시작하기 위해서는 아래와 같이 의존성을 추가해야 한다. org.spring.framwork.boot spring-boot-starter-aop @Aspect을 통해 Aspect로 정의하고 Component 등록을 한다. @Component @Aspect public class PerfAspect { // 1. com.springaop로 시작하는 패키지의 EventService 클래스의 모든 메서드에 적용 //@Around("execution(* com.springaop..*.EventService.*(..))") // 2. 아래 PerfLogging 어노테이션이 적용된 곳만 적용 @Around("@annotation(PerfLogging)") // 3. 해당 Bean의 모든 메서드에..