Package org.springframework.aop.aspectj.annotation

# Class ReflectiveAspectJAdvisorFactory

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

All Implemented Interfaces:
  `Serializable`, `AspectJAdvisorFactory`

public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFactory implements Serializable
Factory that can create Spring AOP Advisors given AspectJ classes from classes honoring AspectJ's annotation syntax, using reflection to invoke the corresponding advice methods.

Since:
  2.0
Author:
  Rod Johnson, Adrian Colyer, Juergen Hoeller, Ramnivas Laddad, Phillip Webb, Sam Brannen
See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static class`
`ReflectiveAspectJAdvisorFactory.SyntheticInstantiationAdvisor`
Synthetic advisor that instantiates the aspect.

## Nested classes/interfaces inherited from class org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory

`AbstractAspectJAdvisorFactory.AspectJAnnotation, AbstractAspectJAdvisorFactory.AspectJAnnotationType`

## Field Summary

### Fields inherited from class org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory

`IGNORE_AJC_PROPERTY_NAME, logger, parameterNameDiscoverer`

## Constructor Summary

Constructors
Constructor
Description
`ReflectiveAspectJAdvisorFactory()`
Create a new `ReflectiveAspectJAdvisorFactory`.
`ReflectiveAspectJAdvisorFactory(org.springframework.beans.factory.BeanFactory beanFactory)`
Create a new `ReflectiveAspectJAdvisorFactory`, propagating the given `BeanFactory` to the created `AspectJExpressionPointcut` instances, for bean pointcut handling as well as consistent `ClassLoader` resolution.

## Method Summary

Modifier and Type
Method
Description
`Advice`
`getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName)`
Build a Spring AOP Advice for the given AspectJ advice method.
`Advisor`
`getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrderInAspect, String aspectName)`
Build a Spring AOP Advisor for the given AspectJ advice method.
`List<Advisor>`
`getAdvisors(MetadataAwareAspectInstanceFactory aspectInstanceFactory)`
Build Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.

### Methods inherited from class org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory

`findAspectJAnnotationOnMethod, isAspect, validate`

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

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

## Constructor Details

### ReflectiveAspectJAdvisorFactory

public ReflectiveAspectJAdvisorFactory()
Create a new `ReflectiveAspectJAdvisorFactory`.

### ReflectiveAspectJAdvisorFactory

public ReflectiveAspectJAdvisorFactory(@Nullable org.springframework.beans.factory.BeanFactory beanFactory)
Create a new `ReflectiveAspectJAdvisorFactory`, propagating the given `BeanFactory` to the created `AspectJExpressionPointcut` instances, for bean pointcut handling as well as consistent `ClassLoader` resolution.

Parameters:
  `beanFactory` - the BeanFactory to propagate (may be `null`)
Since:
  4.3.6
See Also:
  - `AspectJExpressionPointcut.setBeanFactory(org.springframework.beans.factory.BeanFactory)`
  - `ConfigurableBeanFactory.getBeanClassLoader()`

## Method Details

### getAdvisors

public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory aspectInstanceFactory)
Description copied from interface: `AspectJAdvisorFactory`
Build Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.

Specified by:
  `getAdvisors` in interface `AspectJAdvisorFactory`
Parameters:
  `aspectInstanceFactory` - the aspect instance factory (not the aspect instance itself in order to avoid eager instantiation)
Returns:
  a list of advisors for this class

### getAdvisor

@Nullable public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrderInAspect, String aspectName)
Description copied from interface: `AspectJAdvisorFactory`
Build a Spring AOP Advisor for the given AspectJ advice method.

Specified by:
  `getAdvisor` in interface `AspectJAdvisorFactory`
Parameters:
  `candidateAdviceMethod` - the candidate advice method
  `aspectInstanceFactory` - the aspect instance factory
  `declarationOrderInAspect` - the declaration order within the aspect
  `aspectName` - the name of the aspect
Returns:
  `null` if the method is not an AspectJ advice method or if it is a pointcut that will be used by other advice but will not create a Spring advice in its own right

### getAdvice

@Nullable public Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName)
Description copied from interface: `AspectJAdvisorFactory`
Build a Spring AOP Advice for the given AspectJ advice method.

Specified by:
  `getAdvice` in interface `AspectJAdvisorFactory`
Parameters:
  `candidateAdviceMethod` - the candidate advice method
  `expressionPointcut` - the AspectJ expression pointcut
  `aspectInstanceFactory` - the aspect instance factory
  `declarationOrder` - the declaration order within the aspect
  `aspectName` - the name of the aspect
Returns:
  `null` if the method is not an AspectJ advice method or if it is a pointcut that will be used by other advice but will not create a Spring advice in its own right
See Also:
  - `AspectJAroundAdvice`
  - `AspectJMethodBeforeAdvice`
  - `AspectJAfterAdvice`
  - `AspectJAfterReturningAdvice`
  - `AspectJAfterThrowingAdvice`