具有类名模式的切入点 [英] Pointcut with a class name pattern
本文介绍了具有类名模式的切入点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
test.core,我希望该类中的每个类都有一个方面,或者是一个名称模式为 Service 的子包.
test.core and I want an aspect around every class in that or a sub-package with the name pattern Service.
像这样:"execution(public de.test.core .. Service .*(..)"",但似乎不起作用.
sth like this: "execution(public de.test.core..Service.*(..)" but it doesn t seem to work.
aspectJ还能匹配类模式吗?
Is aspectJ even able to match to a class pattern?
推荐答案
匹配名称以"Service"结尾的bean中定义的所有方法.
Match all methods defined in beans whose name ends with ‘Service’.
bean(*Service)
按服务匹配模式
@Pointcut("within(*..*Service)")
public void inServiceClass() {}
这篇关于具有类名模式的切入点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文