AOP introduction
While writing any software application, the best practice is to divide your code into multiple independent modules based on business use cases. For example, you write an Employee Service class for all employee-related functions, an HRService class for all HR-related functions, and so on and so forth.
In general, the whole application consists of a set of independent classes that span multiple verticals and doesn’t share the same class hierarchy. This diagram depicts this scenario:
Irrespective of the independent nature of each vertical, there are a few common items you need to implement across all of them, such as transaction management, session management, audit logging, security, caching, or any such custom processing mechanism based on rules.
If you wish to implement these common services across verticals with a traditional approach, you need to put them into each of the methods in these classes manually. Taking an example of a logging mechanism, for this, you would need...