Spring AOP Pointcut 표현식 - bean
목차 Spring AOP Pointcut 표현식 - this, target Spring AOP Pointcut 표현식 - 매게변수 전달 Spring AOP Pointcut 표현식 - bean Spring AOP Pointcut 표현식 - @annotation, @args Spring AOP Pointcut 표현식 - @target, @within Spring AOP Pointcut 표현식 - args Spring AOP Pointcut 표현식 - within Spring AOP - Pointcut 표현식 execution Spring 핵심원리 고급편 - Pointcut @Slf4j@Import(BeanTest.BeanAspect.class)@SpringBootTestpublic class BeanTest { @Autowired OrderService orderService; @Test void success(){ orderService.orderItem("itemA"); } @Aspect static class BeanAspect{ @Around("bean(orderService) || bean(*Repository)") public Object doLog(ProceedingJoinPoint joinPoint) throws Throwable { log.info("[bean] {}", joinPoint.getSignature()); return joinPoint.proceed(); } }} 2021-12-21 00:13:43.463 INFO 35836 --- [ Test worker] com.example.aop.pointcut.BeanTest : [bean] void com.example.aop.order.OrderService.orderItem(String)2021-12-21 00:13:43.474 INFO 35836 --- [ Test worker] com.example.aop.order.OrderService : [orderService] 실행2021-12-21 00:13:43.475 INFO 35836 --- [ Test worker] com.example.aop.pointcut.BeanTest : [bean] String com.example.aop.order.OrderRepository.save(String)2021-12-21 00:13:43.480 INFO 35836 --- [ Test worker] com.example.aop.order.OrderRepository : [orderRepository] 실행