【发布时间】:2017-12-25 09:01:38
【问题描述】:
我有几个 SomeInterface 的实现。问题是在 SomeInterface 的所有实现中方法 executeSomething 的切入点是什么。
public class SomeImplementation implements SomeInterface {
public String executeSomething(String parameter) {
// Do something
}
}
public class AnotherImplementation implements SomeInterface {
public String executeSomething(String parameter) {
// Do something different way
}
}
【问题讨论】:
-
您真的对接口的所有实现感兴趣吗,难道“所有类都具有名称为 X 的方法”就足够了吗?如果是这样,您可以使用
@Pointcut("execution(* *.*.executeSomething(..))"),对吗? -
"all classes have method with name X" 如果没有其他类(不是接口的实现),则可以。感谢您的建议,但理想情况下我需要所有实现