Category: Pointcut

0

Spring 핵심원리 고급편 - Pointcut

목차 Spring AOP Pointcut 표현식 - this, target Spring AOP Pointcut 표현식 - Advice 에 매게변수 전달 Spring AOP Pointcut 표현식 - bean Spring AOP Pointcut 표현식 - @args Spring AOP Pointcut 표현식 - @annotation Spring AOP Pointcut 표현식 - @target, @within Spring AOP Pointcut 표현식 - args Spring AOP Pointcut 표현식 - within Spring AOP Pointcut 표현식 - execution Spring 핵심원리 고급편 - Pointcut @Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)public @interface ClassAop {} @Target(ElementType.METHOD)@Retention(RetentionPolicy.RUNTIME)public @interface MethodAop { String value();} public interface MemberService { String hello(String param);} @ClassAop@Componentpublic class MemberServiceImpl implements MemberService { @Override @MethodAop("test") public String hello(String param) { return null; } public String internal(String param){ return "ok"; }} AspectJExpressionPointcut 이 포인트 컷 표현식을 처리해주는 클래스 @Slf4jpublic class ExecutionTest { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); Method helloMethod; @BeforeEach public void init() throws NoSuchMethodException { helloMethod = MemberServiceImpl.class.getMethod("hello", String.class); } @Test void printMethod(){ log.info("helloMethod = {}", helloMethod); }}