I'm trying to use AspectJ to advise some core classes in Wildfly/undertow. Specifically, I'm trying to advise some of the Undertow HttpSession methods to get some more detailed logging when Sessions are created/expire/etc.
My problem now is that I don't know where to put my jar of aspects for it to be loaded/visible by the weaver for all modules. I've managed to get it to work by modifying the io.undertow.servlet module, adding my jar in the folder and modifying the module.xml, but that only advises the io.undertow.servlet.* classes. And it seems like quite an ugly hack to get to that.
I tried creating an independent module for it, and declaring it as a global module in my standalone.xml, but that didn't seem to work. Nor did modifying the servlet module.xml and specifying my module as a dependency.
I tried to add it to the startup parameters in the standalone.conf file, specifying it as -classpath path/to/myaspect.jar, but that only advised the startup WF (org.jboss) classes and none of the modules.
At the moment, I'm looking to advise any implementation of javax.servlet.http.HttpSession.invalidate(). In AJ language, the pointcut is simple: execution(* javax.servlet.http.HttpSession+.invalidate(..)) will match any implementation of the HttpSession interface. However, to make it active, I need to get that Aspect in the classpath of every module loaded and visible to the AJ weaver.
Is there a "generic" place I can declare the the aspects.jar so that it is part of the classpath of every module loaded or is my only choice to modify every module.xml in the system?