Spring AOP pointcut that matches annotation on interface

徘徊边缘 提交于 2019-11-27 07:26:29

If I understand you correct, you want a pointcut that finds all methods in classes that extends MyService and is annotated and with the preferred arguments.

I propose that you replace:

execution(public * com.mycompany.myserviceimpl.*(..))

with:

execution(public * com.mycompany.myservice.MyService+.*(..))

The plus sign is used if you want a joinpoint to match the MyService class or a class that extends it.

I hope it helps!

Espen, your code works only for one class:

execution(public * com.mycompany.myservice.MyService+.*(..))

but what if I want this behaviour for all services in *com.mycompany.services.** package?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!