You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
포인트컷 지시자
종류
execution: 메소드 실행 조인 포인트를 매칭한다. 스프링 AOP에서 가장 많이 사용하고, 기능도 복잡하다.within: 특정 타입 내의 조인 포인트를 매칭한다.args: 인자가 주어진 타입의 인스턴스인 조인 포인트this: 스프링 빈 객체(스프링 AOP 프록시)를 대상으로 하는 조인 포인트target: Target 객체(스프링 AOP 프록시가 가리키는 실제 대상)를 대상으로 하는 조인 포인트@target: 실행 객체의 클래스에 주어진 타입의 애노테이션이 있는 조인 포인트@within: 주어진 애노테이션이 있는 타입 내 조인 포인트@annotation: 메서드가 주어진 애노테이션을 가지고 있는 조인 포인트를 매칭-
@args: 전달된 실제 인수의 런타임 타입이 주어진 타입의 애노테이션을 갖는 조인 포인트bean: 스프링 전용 포인트컷 지시자, 빈의 이름으로 포인트컷을 지정한다.ClassAop
MethodAop
MemberService
ExecutionTest
execution1
execution 문법
가장 정확한 포인트컷
ExecutionTest - 추가
매칭 조건
접근제어자?: public
반환타입: String
선언타입?: hello.aop.member.MemberServiceImpl
메서드이름: hello
파라미터: (String)
예외?: 생략
MemberServiceImpl.hello(String) 메서드와 포인트컷 표현식의 모든 내용이 정확하게 일치한다. 따라서 true 를 반환한다.
가장 많이 생략한 포인트 컷
매칭 조건
메서드 이름 매칭 관련 포인트컷
패키지 매칭 관련 포인트컷
hello.aop.member.*(1).*(2)패키지에서
.,..의 차이를 이해해야 한다.execution2
타입 매칭 - 부모 타입 허용
타입 매칭 - 부모 타입에 있는 메서드만 허용
타입에 있는 hello(String) 메서드는 매칭에 성공하지만, 부모 타입에 없는 internal(String) 는 매칭에 실패한다.
파라미터 매칭
execution 파라미터 매칭 규칙은 다음과 같다.
within
주의
within사용시 주의해야 할 점이 있다. 표현식에 부모 타입을 지정하면 안된다는 점이다. 정확하게 타입이 맞아야 한다. 이 부분에서execution과 차이가 난다.WithinTest - 추가
인할 수 있다.
All reactions