[英]How to implement AOP for someone else's bundles in OSGI (Apache Felix)?
I want to add AOP for classes of different bundles in OSGI (Apache Felix) 我想为OSGI(Apache Felix)中不同捆绑包的类添加AOP
I need to create Aspect and to add crosscutting functionality into methods of each implementation specific interface. 我需要创建Aspect并将横切功能添加到每个实现特定接口的方法中。 (prefered with help aspectj)
(最好是具有aspectj帮助)
Problems: 问题:
please help 8) 请帮忙8)
OSGi has a Weavinghook that allows you to intercept class loading. OSGi具有一个Weavinghook,可让您拦截类加载。 This hook allows you to inspect the byte code and modify it before it becomes a class.
这个钩子允许您检查字节码并在它成为一个类之前对其进行修改。 It also allows you to add imports.
它还允许您添加导入。
The OSGi weavinghooks specification that covers weaving of classes for adding aspects. OSGi weavinghooks规范,涵盖了用于添加方面的类的编织。
Here is an example of how to use it. 这是一个如何使用它的例子 。 The example uses asm but I am pretty sure you can adapt it for aspectj.
该示例使用了asm,但是我很确定您可以将其调整为Aspectj。
Another example uses aspectj but does not have much doc and also misses a command line build. 另一个示例使用aspectj,但没有太多文档,并且也缺少命令行构建。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.