Aspect-Oriented Programming
Course Spring Boot 3, Spring 6 & Hibernate for Beginners on Udemly (Section 10 AOP: Aspect Oriented Programming).
Programming technique based on concept of an Aspect.
Aspect encapsulate cross-cutting-logic.
Concerns are the different aspects of functionality that the software system provides. Separation of Concerns (SoC) is a design principle that manages complexity by partitioning the software system so that each partition is responsible for a separate concern, minimizing the overlap of concerns as much as possible.
Concerns cannot be descomposed from the rest of the systems and it can result in code duplication, significant dependencies between systems or both. For example: logging a history of changes to the record database or user database, an authentication system, security, exception handling, etc.
Advices Types:
Before advice: run before the method
After finally advice: run after the method (finally)
After returning advice: run after the method (success execution)
After throwing advice: run after method (if exception thrown)
Around advice: run before and after method
Concepts:
These programs contain example of how to use this technique.
Result after running spring-demo-app is: