So far, we have learned about the concept of dependency injection and its implementation in popular frameworks, such as Spring and Google Guice. We also learned how to control the object creation process by scoping beans based on business requirements. In this chapter, we will learn another way of implementing separation of concerns: aspect-oriented programming (AOP).
AOP solves a different portion of the design problem by isolating repeated code from the application and plugging it in dynamically. AOP, along with Inversion of Control (IoC), brings modularity to the application. AOP helps in organizing your application in layer fashion, which would be impossible in the traditional object-oriented approach.
AOP permits you to intercept the flow of business code and straightforwardly inject a set of functionalities, without...