Aspect-Oriented Programming and Interceptors

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 ...

Get Java 9 Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.