6 Using aspects with Spring AOP
This chapter covers
- What aspect-oriented programming (AOP) is
- Using aspects
- Using the aspect execution chain
Up to now, we discussed the Spring context, and the only Spring capability we used was dependency injection (DI). Dependency Injection is a technique supported by the Inversion-of-Control (IoC) principle. With dependency injection, the framework manages objects you define, and you can request to use these objects where you need them. As we discussed in chapters 2 through 5, to request a bean's reference, you use, in most cases, the @Autowired annotation. When you request such an object from the Spring context, we say that Spring “injects” the object where you requested it. In this context, “Spring injects the object” is equivalent to “Spring provides an object”. In this chapter, you’ll learn how to use another powerful technique supported by the IoC principle: aspects.