문제 설명
OSGI(Apache Felix)에서 다른 사람의 번들에 대해 AOP를 구현하는 방법은 무엇입니까? (How to implement AOP for someone else's bundles in OSGI (Apache Felix)?)
OSGI(Apache Felix)
에서 다양한 번들의 클래스에 대해 AOP를 추가하고 싶습니다.Aspect</를 생성해야 합니다. strong> 및 각 구현별 인터페이스의 메소드에 교차 기능을 추가합니다. (help aspectj와 함께 선호)
문제:
- 서로 다른 번들에서 목표 인터페이스의 모든 구현
- 각 번들 자체 클래스 경로가 있습니다.
- 우리는 마녀 번들에 인터페이스 구현이 있는지 모릅니다
도와주세요 8)
참조 솔루션
방법 1:
OSGi has a Weavinghook that allows you to intercept class loading. This hook allows you to inspect the byte code and modify it before it becomes a class. It also allows you to add imports.
방법 2:
The OSGi weavinghooks specification that covers weaving of classes for adding aspects.
Here is an example of how to use it. The example uses asm but I am pretty sure you can adapt it for aspectj.
Another example uses aspectj but does not have much doc and also misses a command line build.
(by vvator、Peter Kriens、Christian Schneider)