부모 클래스 :부모 클래스에서 메서드를 어떻게 교차합니까?
public class Animal {
public String name() {
return "my name";
}
}
아이 클래스 : 나는 AspectJ를 가진 Dog.name()
를 호출 샛길하기 위해 노력하고있어,하지만 작동하지 않습니다
public class Dog extends Animal {
// no methods
}
:
그러나@Aspect
public class Crosscut {
@Around("execution(* Dog.name())")
public Object exec(ProceedingJoinPoint point) {
// this point is never reached
}
}
, Dog
클래스에 하위 메서드를 추가하면 크로스 커브가 작동합니다.
public class Dog extends Animal {
public String name() {
return super.name();
}
}
올바른 크로스 커팅 방법은 무엇입니까? 또는 전혀 불가능합니다.
을 고마워,'* .name()'을 사용하여 모든 클래스를'name()'메소드와 일치시킬 수 있습니까? – yegor256
이 경우 더하기 기호가 필요하지 않습니다. ;-) – kriegaex