Java Reference
In-Depth Information
You can match the method execution join points within all classes that implement the
ArithmeticCalculator interface by adding a plus symbol.
Your custom annotation @LoggingRequired can be applied to the class level instead of the
method level.
package com.apress.springenterpriserecipes.calculator;
public class ArithmeticCalculatorImpl implements ArithmeticCalculator {
Then you can match the join points within the classes that have been annotated with
@LoggingRequired .
Bean Name Patterns
Spring supports a new pointcut type that is used to match bean names. For example, the following
pointcut expression matches beans whose name ends with Calculator :
Caution This pointcut type is supported only in XML-based Spring AOP configurations, not in AspectJ annotations.
Combining Pointcut Expressions
In AspectJ, pointcut expressions can be combined with the operators && (and), || (or), and ! (not).
For example, the following pointcut matches the join points within classes that implement either the
ArithmeticCalculator or UnitCalculator interface:
within(ArithmeticCalculator+) || within(UnitCalculator+)
The operands of these operators can be any pointcut expressions or references to other pointcuts.
package com.apress.springenterpriserecipes.calculator;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
public class CalculatorPointcuts {
public void arithmeticOperation() {}
Search WWH ::

Custom Search