切入点截取以prefix-2开头的类的前缀-1开始的方法的执行?

时间:2017-05-06 06:25:22

标签: java spring aop aspectj spring-aop

我想知道是否可以编写@Pointcut执行表达式,它只匹配给定包中特定类集的特定方法。说,包是:

x.y.z.service

内部有一些接口及其实现类:

x.y.z.service.Foo1
x.y.z.service.Foo1Impl
x.y.z.service.Foo2
x.y.z.service.Foo2Impl

x.y.z.service.Bar1
x.y.z.service.Bar1Impl
x.y.z.service.Bar2
x.y.z.service.Bar2Impl

我只需要从Foo*开始使用httpRequest开头的方法。 Bar*中的某些方法也以httpRequest开头,但切入点应忽略这些方法。试过以下(有一些变化),但似乎没有触发任何东西:

@Pointcut("execution(* x.y.z.service.Foo*.httpRequest*(..))")
public void httpRequest() {}

@Around("httpRequest()")
public Object doSomethingHere(ProceedingJoinPoint jp) {...}

是否可以表达排序以及正确的方法?

0 个答案:

没有答案
相关问题