Package org.springframework.aop.aspectj.annotation

# Class AbstractAspectJAdvisorFactory

java.lang.Object
org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory

All Implemented Interfaces:
  `AspectJAdvisorFactory`

Direct Known Subclasses:
  `ReflectiveAspectJAdvisorFactory`

public abstract class AbstractAspectJAdvisorFactory extends Object implements AspectJAdvisorFactory
Abstract base class for factories that can create Spring AOP Advisors given AspectJ classes from classes honoring the AspectJ 5 annotation syntax.

This class handles annotation parsing and validation functionality. It does not actually generate Spring AOP Advisors, which is deferred to subclasses.

Since:
  2.0
Author:
  Rod Johnson, Adrian Colyer, Juergen Hoeller, Sam Brannen

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static class`
`AbstractAspectJAdvisorFactory.AspectJAnnotation`
Class modeling an AspectJ annotation, exposing its type enumeration and pointcut String.
`protected static enum`
`AbstractAspectJAdvisorFactory.AspectJAnnotationType`
Enum for AspectJ annotation types.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`IGNORE_AJC_PROPERTY_NAME`
System property that instructs Spring to ignore ajc-compiled aspects for Spring AOP proxying, restoring traditional Spring behavior for scenarios where both weaving and AspectJ auto-proxying are enabled.
`protected final org.apache.commons.logging.Log`
`logger`
Logger available to subclasses.
`protected final org.springframework.core.ParameterNameDiscoverer`
`parameterNameDiscoverer`

## Constructor Summary

Constructors
Constructor
Description
`AbstractAspectJAdvisorFactory()`

## Method Summary

Modifier and Type
Method
Description
`protected static AbstractAspectJAdvisorFactory.AspectJAnnotation`
`findAspectJAnnotationOnMethod(Method method)`
Find and return the first AspectJ annotation on the given method (there should only be one anyway...).
`boolean`
`isAspect(Class<?> clazz)`
Determine whether the given class is an aspect, as reported by AspectJ's `AjTypeSystem`.
`void`
`validate(Class<?> aspectClass)`
Is the given class a valid AspectJ aspect class?

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.aop.aspectj.annotation.AspectJAdvisorFactory

`getAdvice, getAdvisor, getAdvisors`

## Field Details

### IGNORE_AJC_PROPERTY_NAME

public static final String IGNORE_AJC_PROPERTY_NAME
System property that instructs Spring to ignore ajc-compiled aspects for Spring AOP proxying, restoring traditional Spring behavior for scenarios where both weaving and AspectJ auto-proxying are enabled.

The default is "false". Consider switching this to "true" if you encounter double execution of your aspects in a given build setup. Note that we recommend restructuring your AspectJ configuration to avoid such double exposure of an AspectJ aspect to begin with.

Since:
  6.1.15
See Also:
  - Constant Field Values

### logger

protected final org.apache.commons.logging.Log logger
Logger available to subclasses.

### parameterNameDiscoverer

protected final org.springframework.core.ParameterNameDiscoverer parameterNameDiscoverer

## Constructor Details

### AbstractAspectJAdvisorFactory

public AbstractAspectJAdvisorFactory()

## Method Details

### isAspect

public boolean isAspect(Class<?> clazz)
Description copied from interface: `AspectJAdvisorFactory`
Determine whether the given class is an aspect, as reported by AspectJ's `AjTypeSystem`.

Will simply return `false` if the supposed aspect is invalid (such as an extension of a concrete aspect class). Will return true for some aspects that Spring AOP cannot process, such as those with unsupported instantiation models. Use the `AspectJAdvisorFactory.validate(java.lang.Class<?>)` method to handle these cases if necessary.

Specified by:
  `isAspect` in interface `AspectJAdvisorFactory`
Parameters:
  `clazz` - the supposed annotation-style AspectJ class
Returns:
  whether this class is recognized by AspectJ as an aspect class

### validate

public void validate(Class<?> aspectClass) throws AopConfigException
Description copied from interface: `AspectJAdvisorFactory`
Is the given class a valid AspectJ aspect class?

Specified by:
  `validate` in interface `AspectJAdvisorFactory`
Parameters:
  `aspectClass` - the supposed AspectJ annotation-style class to validate
Throws:
  `AopConfigException` - if the class is an invalid aspect (which can never be legal)
  `NotAnAtAspectException` - if the class is not an aspect at all (which may or may not be legal, depending on the context)

### findAspectJAnnotationOnMethod

@Nullable protected static AbstractAspectJAdvisorFactory.AspectJAnnotation findAspectJAnnotationOnMethod(Method method)
Find and return the first AspectJ annotation on the given method (there should only be one anyway...).