// 매게변수 값을 전달 받을 수 있습니다. @Around("allMember() && args(arg,..)") public Object logArgs2(ProceedingJoinPoint joinPoint, Object arg)throws Throwable { log.info("[logArgs2]{}, arg={}", joinPoint.getSignature(), arg); return joinPoint.proceed(); }
@Before("allMember() && @annotation(annotation)") publicvoidatAnnotation(JoinPoint joinPoint, MethodAop annotation) { // @ MethodAop 내의 value 값을 꺼내올 수 있습니다. log.info("[@annotation]{}, annotationValue={}", joinPoint.getSignature(), annotation.value()); }
2024-11-2812:28:56.889 INFO 85888 --- [ Test worker] h.a.p.ParameterTest$ParameterAspect : [@target]String hello.aop.member.MemberServiceImpl.hello(String), obj=@hello.aop.member.annotation.ClassAop() 2024-11-2812:28:56.889 INFO 85888 --- [ Test worker] h.a.p.ParameterTest$ParameterAspect : [@within]String hello.aop.member.MemberServiceImpl.hello(String), obj=@hello.aop.member.annotation.ClassAop() 2024-11-2812:28:56.889 INFO 85888 --- [ Test worker] h.a.p.ParameterTest$ParameterAspect : [@annotation]String hello.aop.member.MemberServiceImpl.hello(String), annotationValue=test value