Best solution for using AOP with OSGI?

感情迁移 提交于 2019-12-23 12:24:14

问题


I am using Equinox, so the Equinox Aspect project seems like a no-brainer, but that project appears to be inactive and has only one page of documentation that leaves me hanging at the end.

Other than that project, I do not see many options for using AOP in OSGI. Let me know what you all think and what the possibilities are, thanks :)


回答1:


I don't know of any alternative, but I didn't think Equinox Aspects was inactive. It's even receiving new features in the upcoming Helios release.




回答2:


The big issue is obviously with the lack of standardized loadtime weaving; Equinox Aspects and the weaver (used by AJDT) has been the only option for now. The good news is that bytecode weaving in all its glory is actively in progress in the OSGi working group and will "soon" be standardized. If you really need something that works reliably right now, your best bet is still compile-time weaving. IMHO that is a much better approach anyway, at least for AOP as design-time activity as it was originally envisioned..




回答3:


As an alternative, you could also consider using the Apache Felix Dependency Manager, which allows you to at runtime add interceptors to existing OSGi services. Of course this is in no way a full AOP replacement, but for some use cases it might be enough.

You can find more documentation and an example here:

http://felix.apache.org/site/apache-felix-dependency-manager-osgi-design-patterns.html



来源:https://stackoverflow.com/questions/3086011/best-solution-for-using-aop-with-osgi

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