[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Enabling LTW dynamically without the -javaagent?
|
I am not versed in container applications, but your understanding here
any classes loaded prior to the LTW agent being attached won't be woven
is correct. In a way, this thought is also somewhat pacifying because it should not be so easy to mess with classloading inside a container as this could be considered a security problem. So unless you have control over how the container is started (-javaagent) or find a way to hook into classloading, you should rather resort to CTW. But maybe someone else here knows how to do what you want from within a container. There might be container-specific ways or even standardised ones, but I do not have the slightest idea. So why not use CTW in connection with 'if()' pointcuts and a configurable condition in order to toggle aspect execution?
--
Alexander Kriegisch
https://scrum-master.de
Eric B schrieb am 18.10.2017 03:30:
Thanks for the link/pointer. I read through it, but am still unclear how/where this becomes useful. It is obvious how it can be used in a standard console java application with a single "main" entry point. This would also apply to any self-contained Spring Boot applications (or their equivalences). But can something like this be used in any web container? Be it a tomcat, jetty, wildfly, etc. ? I don't know of a single entry point, equivalent to a "main" in a console application.
From what I understand from the release notes, any classes loaded prior to the LTW agent being attached won't be woven. So in the case of a JEE app (ie: EJBs, etc), the container scans and loads beans in the Dependency tree long before the application "starts". So one would need to hook into the classloading mechanism itself, or provide a custom classloader? Do you know if there is a mechanism to do this reliably? I would obviously want the Agent loaded as the first class in my EAR.