i have a Java EE Webservice (REST) and would now like to use AspectJ, to create a rule that will print-out every incoming service call and their params.
I just read this tutorial and implemented the following code:
POM.XML
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<Xlint>ignore</Xlint>
<encoding>UTF-8 </encoding>
</configuration>
<executions>
<execution>
<goals>
<!-- use this goal to weave all your main classes -->
<goal>compile</goal>
<!-- use this goal to weave all your test classes -->
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
...and created a Test.aj File, with a Pointcut which should print-out a teststring after calling the getSignOfLife():
import de.jack.businesspartner.service.BusinessPartnerServiceImpl;
public aspect TestAspectJ {
pointcut getSignOfLife() :
call(void BusinessPartnerServiceImpl.getSignOfLife());
before() : getSignOfLife() {
System.err.println("ADKL TEST ASPECT");
}
}
--> But nothing happens if i call the getSignOfLife() Method. Can you help me?