Aspect Oriented Programming(AOP) with Spring
December 16th, 2009
7 comments
Aspects Oriented programming(AOP) is another way of programming in Spring. Instead of Object oriented programming, in which the key unit is class , in AOP the key unit is aspect.
AOP framework is part of the Spring and comes bundled with it. No additional installation is required. Spring AOP is implemented in pure Java and can be used in a web container or enterprise server. Before we move ahead with an example , let us look at some terminologies which we will be using in this application
- Aspect: a modularization of a concern that cuts across multiple classes. Transaction management is a good example of a crosscutting concern in Java EE applications.
- Join point: a point during the execution of a program, such as the execution of a method or the handling of an exception. In Spring AOP, a join point always represents a method execution.
- Advice: action taken by an aspect at a particular join point. Different types of advice include “around,” “before” and “after” advice. (Advice types are discussed below.) Many AOP frameworks, including Spring, model an advice as an interceptor, maintaining a chain of interceptors around the join point.
- Pointcut: a predicate that matches join points. Advice is associated with a pointcut expression and runs at any join point matched by the pointcut (for example, the execution of a method with a certain name). The concept of join points as matched by pointcut expressions is central to AOP, and Spring uses the AspectJ pointcut expression language by default. Read more…

