Sunday, August 18, 2013

PerfSpy 7 -- Run AspectJ applications in Eclipse “load-time weaving” style

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: 

Run PerfSpyDemo as “AspectJ Load-Time Weaving Applcation”:


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:

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.)







No comments:

Post a Comment