View RSS Feed

Spring Framework

More AOP in Spring Part 2

Rate this Entry
by , 11-16-2011 at 06:26 PM (1519 Views)
Along with aspect’s advice, pointcuts, which are used to pinpoint where an aspect’s advice should be applied, are considered among the most fundamental elements of an aspect. In Spring AOP, we define pointcuts using AspectJ’s pointcut expression language. If you’re already know AspectJ, then defining pointcuts in Spring should feel natural. Otherwise, I will provide you with quick tips that will help you with writing AspectJ-style pointcuts.

In Spring AOP, the key thing to remember is that Spring only supports a subset of the pointcut designators available in AspectJ as was mentioned in our last tip. This is because Spring AOP is proxy-based and certain pointcut expressions are not relevant to proxy-based AOP. The list below shows the AspectJ pointcut designators that are supported in Spring AOP.

Name:  SpringAOP2.jpg
Views: 279
Size:  115.2 KB

The execution designator is the only one that actually performs matches while all the other designators are used to limit those matches. The implication of this is that execution is the primary designator you’ll use in every pointcut definition you write. The rest of the designators are used to constrain the pointcut’s reach. In the final tip on Spring AOP, we will write some code to show how AOP is used in Spring.

Submit "More AOP in Spring Part 2" to Facebook Submit "More AOP in Spring Part 2" to Digg Submit "More AOP in Spring Part 2" to del.icio.us Submit "More AOP in Spring Part 2" to StumbleUpon Submit "More AOP in Spring Part 2" to Google

Tags: aop, spring aop Add / Edit Tags
Categories
AOP

Comments