PerfSpyDemo and PerfSpyAspectDemo are two separate projects. When PerfSpyDemo is running, PerfSpyAspectDemo peeks into PerfSpyDemo (this is called load-time weaving) and spies on Dolphin’s actions. This blog shows you how to run an AspectJ application in Eclipse using "load time weaving".
Compare with compile-time weaving:
- Compile-time weaving: AspectJ weaves aspects into application classes at compile time.
- Load-time weaving: AspectJ weaves aspects into application classes when they are loaded.
PerfSpyDemo’s dependent libraries are:
To enable load-time weaving, configure PerfSpyDemo’s runtime:
Add aspectjwearver.jar into JVM arguments:
Add PerfSpy libraries into LTW AspectPath:
Before you run PerfSpyDemo, you will need to create these Oracle objects for PerfSpy to dump spying information to:
- perfspyseq.sql : sequence for every spied event
- perfspyevent.sql :spied event
- perfspyops.sql : spied method
- perfspyopdetail.sql : detailed information for every spied method
Now, when you start up PerfSpyDemo, PerfSpyAspectDemo sneaks in. PerfSpyAspectDemo manipulates application classes and makes them do things outside their authors’ knowledge (fortunately, it just spies, not steals.)