at runtime, create a subclass that intercepts all method invocations Spring AOP Hibernate proxies EJB proxies CDI proxies java.lang.reflect.Proxy is not enough
agent attaches to the running JVM META-INF/MANIFEST.MF is required Requires support for loading agents in JVM Allows adding the code to JVM post-factum
//get system properties in the target VM Properties props = vm.getSystemProperties(); //load agent into the VM vm.loadAgent("agent.jar", "arg1=x,arg2=y"); //detach from VM vm.detach(); http://docs.oracle.com/javase/7/docs/jdk/api/attach/spec/com/sun/tools/attach/VirtualMachine.html