img
Note Static and dynamic AOP are distinct from the static and dynamic crosscutting concepts. The
differentiation between static and dynamic crosscutting is largely academic and is of no relevance to Spring AOP.
For more information on this topic and on AOP as a whole, we recommend you read AspectJ in Action: Enterprise
AOP with Spring Applications, second edition, by Ramnivas Laddad (Manning, 2010).
Spring AOP architecture: In this section, we get down to the nitty-gritty of Spring's
·
AOP implementation. Spring AOP is only a subset of the full AOP feature set found
in other implementations like AspectJ. In this section, we take a high-level look at
which features are present in Spring, how they are implemented, and why some
features are excluded from the Spring implementation.
Proxies in Spring AOP: Proxies are a huge part of how Spring AOP works, and you
·
must understand them to get the most out of Spring AOP. In this section, we look
at the two kinds of proxy: the JDK dynamic proxy and the CGLIB proxy. In
particular, we look at the different scenarios in which Spring uses each proxy, the
performance of the two proxy types, and some simple guidelines to follow in your
application to get the most from Spring AOP.
Using Spring AOP: In this section, we present some practical examples of AOP
·
usage. We start off with a simple "Hello World" example to ease you into Spring's
AOP code, and we continue with a detailed description of the different AOP
features that are available in Spring, complete with examples.
In this chapter, we cover Spring AOP in isolation from much of the rest of the framework. In Chapter
7, we take a much more framework-oriented view of Spring AOP, including how to configure AOP using
ApplicationContext.
AOP Concepts
As with most technologies, AOP comes with its own specific set of concepts and terms. It is important
that you understand what these terms mean before we explain how to use AOP in an application. The
following list explains the core concepts of AOP:
Joinpoints: A joinpoint is a well-defined point during the execution of your
·
application. Typical examples of joinpoints include a call to a method, the Method
Invocation itself, class initialization, and object instantiation. Joinpoints are a core
concept of AOP and define the points in your application at which you can insert
additional logic using AOP.
Advice: The code that is executed at a particular joinpoint is the advice. There are
·
many different types of advice, such as before, which executes before the
joinpoint, and after, which executes after it. In OOP, an advice comes in the form
of a method within a class.
Pointcuts: A pointcut is a collection of joinpoints that you use to define when
·
advice should be executed. By creating pointcuts, you gain fine-grained control
over how you apply advice to the components in your application. As mentioned
previously, a typical joinpoint is a Method Invocation. A typical pointcut is the
collection of all Method Invocations in a particular class. Often you can compose
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home