AspectJ & Maven warning: “Advice defined in … has not been applied?”

≡放荡痞女 提交于 2019-12-04 03:45:10
PaulProgrammer

Aha! Found the answer here:

aspectj: why advice cannot be applied?

It has nothing to do with maven.

The reason is that in my example, the method is being called from within the jax-rs framework by indirect loading. The call() advice wants to weave the caller, but the ajc compiler can't know where the caller is. The fix is to change the advice to execution() thusly:

Object around() : execution(@FooAnnotation * *(..)) {...}

This differs because it weaves around the execution (which ajc can find), rather than the caller.

Done.

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