Using Annotations Element Value Pairs in Aspectj

Annotations with element-value pairs Annotations by themselves are really powerful. They give direct control over when an aspect should be run to the developer. Adding element-value pairs makes the already powerful annotations even more powerful, since it enables you to pass information into the aspect. Description Creating an annotation with an element-value pair is in itself quite simple. It can take different parameters and it’s up to the aspect developer to use these in their aspects.

Defining Pointcuts by Annotations

Pointcuts by annotations Using annotations is more convenient than using patterns. While patterns might be anything between a big cannon and a scalpel the annotations are definitely a scalpel, by only getting the pointcuts that the developer has manually specified. You can get the code for this blog series at the Git repository here. Let’s start coding! Requirements: Maven, Java 8, (preferably) an IDE (I’m using IntelliJ) The use of annotations is a precise way to define when an aspect should be run.

Defining Pointcuts by Pattern

Pointcuts by pattern Going through all the different ways of defining pointcuts and explaining them in an easy manner would be a near impossible feat for this post. Rather than aiming for the impossible let’s narrow down the scope, and talk about the most commonly used pointcut definitions and how we can experiment with them. We will get you started with defining your own pointcuts! You can get the code for this blog series at the Git repository here.