spring-instrument javaagent fails to weave classes that are parameters to a junit test class method [SPR-15926] #20480
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
in: test
Issues in the test module
status: waiting-for-triage
An issue we've not yet triaged or decided on
Ken Wang opened SPR-15926 and commented
I have aspectj set up in my spring application, using the spring-instrument javaagent to run my junit test through maven.
Here is some sample code:
The above code does work. However, the following does not:
The problem is that prior to running the test, the maven surefire plugin makes a call to ConfigurableTest.getDeclaredMethods(), which at that point will load class ConfigurableEntity. However, spring has not yet had a chance to enable the loadTimeWeaver yet, and so ConfigurableEntity is unwoven and the above test fails.
I have found some workarounds to the above issue... but I am wondering if this is a known problem. Since this is just a unit test, it isn't too major of a concern, but it worries me that there might be instances in my main application where an advised class is loaded before spring has a chance to enable weaving.
Affects: 4.3.8
The text was updated successfully, but these errors were encountered: