To address the cross-cutting concerns, such as logging, exceptions, and security, Aspect-Oriented Programming (AOP) is used as a programming approach. By introducing AOP as a programming practice, modularization of complex coding is made possible. Usually, the program code consists of various components that will deal with many aspects, such as logging and security. With conventional programming approach, these components are written in a single program that leads to a complex and non-maintainable bundle of code, which may be a threat in the future. AOP makes programmers' lives easy as it is possible for us to compartmentalize the various cross-cutting concerns in multiple aspects. AOP is considered as a complement of OOPS rather its replacement.
The following topics will be covered in this chapter:
AOP basics
AOP terminologies
Simple AOP examples
Spring AOP using AspectJ annotations
Securing UI invocation using Aspects