Aspect Oriented Programming

Aspect Oriented Programming (AOP) includes programming methods and tools that support the modularization of concerns at the level of the source code. Void Framework manages the AOP via the AspectJ and Guice libraries. The first library is more powerful but also more complicated to use, while the latter has fewer capabilities but is simple to use.


AspectJ

AspectJ runtime (aspectjrt) is already provided by the module voidframework-core, but you have to add an extra plugin to compile aspects during the compilation of your application.

<plugin>
    <!-- https://mvnrepository.com/artifact/org.codehaus.mojo/aspectj-maven-plugin -->
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.16.0</version>
    <inherited>true</inherited>
    
    <dependencies>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjtools</artifactId>
            <version>1.9.22</version> <!-- Match version provided by Void Framework  -->
        </dependency>
    </dependencies>
    
    <configuration>
        <complianceLevel>${java.version}</complianceLevel>
        <source>${maven.compiler.source}</source>
        <target>${maven.compiler.target}</target>
        <showWeaveInfo>true</showWeaveInfo>
        <verbose>true</verbose>
        <Xlint>ignore</Xlint>
        <encoding>UTF-8</encoding>
    </configuration>

    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>test-compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Read more about AspectJ at:


Guice

Read more about Guice AOP at: