Creating aspects
As I said earlier, aspects is one of the most important terms in the AOP. Aspect merges the pointcuts and advices in the application. Let's see how to define aspect in the application.
You've already defined the TransferService
interface as the subject of your aspect's pointcuts. Now let's use AspectJ annotations to create an aspect.
Define aspects using Annotation
Suppose in your bank application, you want to generate log for a money transfer service for auditing and tracking to understand customers' behaviors. A business never succeeds without understanding its customers. Whenever you will think about it from the perspective of a business, an auditing is required but isn't central to the function of the business itself; it's a separate concern. Therefore, it makes sense to define the auditing as an aspect that's applied to a transfer service. Let's see the following code which shows the Auditing
class that defines the aspects for this concern:
package com.packt.patterninspring...