Wednesday, August 31, 2016

Running AspectJ (AOP) without Spring!

  • Just make sure you have below dependencies and the plugin available in your pom.xml.
  • Build the project
  • Run your main class
  • You are done!

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.2</version>
</dependency>


<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version>
<configuration>
<complianceLevel>1.7</complianceLevel>
<source>1.7</source>
<target>1.7</target>
<complianceLevel>1.7</complianceLevel>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

1 comment:

  1. Keerthana RajasekharanOctober 15, 2016 at 12:30 AM

    I got what I'm looking for, really appreciate your help. I daily follow your site, has a vast very useful collection!

    ReplyDelete