我正在尝试将切入点应用于子类中的一个已实现的方法,但是没有围绕这个切入点调用AspectMethod。以下是我的配置和代码:
public abstract class ParentClass {
protected abstract void buildResponse(QueryResponse qryResp,ContentSearchServiceResponseImpl cssResp);
}
public class ChildClass extends ParentClass {
@override
public void buildResponse(QueryResponse qryResp,ContentSearchServiceResponseImpl ssResp){
//doSomething
}切入点:
<aop:pointcut id="pointcutId"
expression="execution(public * ParentClass.buildResponse(..))" />或
<aop:pointcut id="pointcutId"
expression="execution(protected * ParentClass.buildResponse(..))" />或
<aop:pointcut id="pointcutId"
expression="execution(public * ParentClass+.buildResponse(..))" />由于上面的切入点的任何配置都没有被创建,我几乎已经尝试过everything.If,任何人对此都有一些想法...我不能直接使用子类的名称,因为在我的例子中,有多个子类实现了这个抽象方法
发布于 2012-11-01 21:19:23
试一试
execution(public * buildResponse(..)) && within(ParentClass+)或
execution(public * buildResponse(..)) && target(ParentClass+)还要记住,如果您使用的是“标准的”基于spring代理的AOP,则类内的内部调用(一个方法调用同一类中的另一个方法)不受任何建议的约束。
https://stackoverflow.com/questions/13172673
复制相似问题