简体   繁体   English

Aspectj:如何将方面从库编织到用户代码中?

[英]aspectj: How to weave aspects from a library into user code?

I have a library with some classes and a few aspects in it. 我有一个包含一些类和某些方面的库。 Say AspectedLib.jar is the file that contains such definitions (created in eclipse, with "export jar file with aspectj support"). 假设AspectedLib.jar是包含此类定义的文件(在eclipse中创建,带有“支持AspectedLib.jar的导出jar文件”)。 If I import the AspectedLib.jar file, and even use some of the classes defined in it, it works, but none of the joinpoints is triggered, ie, the aspects are not executed. 如果我导入AspectedLib.jar文件,甚至使用其中定义的某些类,它都可以工作,但是不会触发任何连接点,即,方面不会执行。

How can I make this work? 我该如何进行这项工作? Ideally, how can I set this up in eclipse*? 理想情况下,如何在Eclipse *中进行设置?

* Version: Juno Service Release 2; *版本:Juno Service Release 2; Build id: 20130225-0426 Build ID:20130225-0426

You need to add the jar to your aspect path. 您需要将jar添加到纵横路径。 In your Eclipse project preferences, go to AspectJ build -> Aspect Path and add the jar. 在您的Eclipse项目首选项中,转到AspectJ build-> Aspect Path并添加jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM