Search code examples
aopjavaagentsaspect

How to start aspectj loadtime weaver agent without restarting jvm / how to start loadtime weaver in code?


Is there any way to start the AspectJ loadtime weaver during the application is running? Means without restarting the JVM and adding -javaagent:... ?

I tried https://stackoverflow.com/a/35775792/3880225 but without any success.


Solution

  • Yes, you can do that, I implemented this capability myself for AspectJ and it was included since version 1.8.7, see release notes for an example.

    But please note that weaving will only work for classes loaded after you have activated the weaver.