Skip to content
☣︎Allows AspectJ Weaving of the class(es) under test at loadtime.
Branch: mirror
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


The easiest way to test aspectj with junit.


Allows AspectJ Weaving of the class(es) under test at loadtime.

Download JAR



To enable AspectJ load time weaving place this annotation on your test class:


Optionally you may want to add something to your classpath for a specific test class. This is maybe the case if you want to put a META-INF/aop.xml file on the classpath for the test. In this case use a combination of these two annotations on your test class:

@AspectJConfig(classpathAdditions = "src/test/hello-resources")

You can also look at the example in the source directory under src/test/java. A very simple example can be found in the test sources in package eu.haobao.junit.aspectj.example.

This JUnit Runner works out of the box in Eclipse and Gradle. But if you run the tests with Maven you will probably have to configure the maven-surefire-plugin. This works for me with Maven, but have a look at this documentation too:


Any feedback and improvements are welcome!

You can’t perform that action at this time.