img
Advice Name
Interface
Description
Introduction
Spring models introductions as special types of
org.springframework.aop
.IntroductionInterceptor
interceptors. Using an introduction interceptor, you can
specify the implementation for methods that are being
introduced by the advice. Introductions are covered in
more detail in the next chapter.
We have found that these advice types, coupled with the Method Invocation joinpoint, allow us to
perform about 90 percent of the tasks we want to perform with AOP. For the other 10 percent, which we
use only rarely, we fall back on AspectJ.
Interfaces for Advice
From our previous discussion of the ProxyFactory class, recall that advice is added to a proxy either
directly, using the addAdvice() method, or indirectly by using an Advisor, with the addAdvisor() method.
The main difference between Advice and Advisor is that an Advisor carries an Advice with the associated
Pointcut, which provides more fine-grained control on which joinpoints the Advice will intercept. With
regard to advice, Spring created a well-defined hierarchy for advice interfaces. This hierarchy is based on
the AOP Alliance interfaces and is shown in detail in Figure 6-2.
This kind of hierarchy has the benefit of not only being sound OO design but also that you can deal
with advice types generically, such as by using a single addAdvice() method on the ProxyFactory, and
you can add new advice types easily without having to modify the ProxyFactory class.
Figure 6-2. Interfaces for Spring advice types
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home