Jul 13th, 2011, 09:47 AM
Load Time Weaving with JUnit in Spring Source
we have load time weaving configured for Tomcat. It runs in standalone tomcat and inside Spring Source. However it does not run while using JUnit. It is obvious that we need to somehow configure the JUnit with load time weaver, but I am not sure how to.
Any help is appreciated.
We are also interested to run JUnit outside of Spring Source, but this is secondary for now. If we can find single solution that works for both - great, if not - we will do one after another.
Spring Source Tool Suite version: 2.7.0
Spring libraries version: 3.0.5
Using Maven (comes with Spring Source)
Jul 14th, 2011, 10:50 AM
How have you set it up under tomcat - are you using the spring config configured LTW or an agent approach? An agent approach would likely also work for JUnit if you add the agent to the launch configuration (open your launch configuration for the JUnit tests and add -javaagent:<pathtoweaver>/aspectjweaver.jar). If not using an agent, I might have to refer you to the Spring-AOP forum as there are likely to be better suited experts on that forum. (And they can probably help more with the running it outside of STS too).
Jul 15th, 2011, 09:41 AM
With tomcat I modified the context.xml to specify load time weaver. This does not work with JUnit because there is no context to load
I did solve the issue when running under SpringSource - added spring instrumentation jar to project lib and specified agent. The only inconvenience so far that for our 30+ JUnit files that we run individually every developer has to manually specify agent in VM parameters. But at least it works.
The left TODO is to specify agent to run for all the JUnit tests in single run and also set standalone Maven build to use the same (outside of SpringSource). These tasks are lower priority
Tags for this Thread