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 the AspectJ 5 annotation syntax, using reflection to invoke the corresponding advice methods.- Since:
- 2.0
- Author:
- Rod Johnson, Adrian Colyer, Juergen Hoeller, Ramnivas Laddad, Phillip Webb
- See Also:
- Serialized Form
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classReflectiveAspectJAdvisorFactory.SyntheticInstantiationAdvisorSynthetic advisor that instantiates the aspect.Nested classes/interfaces inherited from class org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory
AbstractAspectJAdvisorFactory.AspectJAnnotation<A extends Annotation>, AbstractAspectJAdvisorFactory.AspectJAnnotationType
Field Summary
Fields inherited from class org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory
logger, parameterNameDiscoverer
Constructor Summary
Constructors Constructor Description ReflectiveAspectJAdvisorFactory()Create a newReflectiveAspectJAdvisorFactory.ReflectiveAspectJAdvisorFactory(BeanFactory beanFactory)Create a newReflectiveAspectJAdvisorFactory, propagating the givenBeanFactoryto the createdAspectJExpressionPointcutinstances, for bean pointcut handling as well as consistentClassLoaderresolution.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AdvicegetAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName)Build a Spring AOP Advice for the given AspectJ advice method.AdvisorgetAdvisor(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
Constructor Detail
ReflectiveAspectJAdvisorFactory
public ReflectiveAspectJAdvisorFactory()
Create a newReflectiveAspectJAdvisorFactory.
ReflectiveAspectJAdvisorFactory
public ReflectiveAspectJAdvisorFactory(BeanFactory beanFactory)
Create a newReflectiveAspectJAdvisorFactory, propagating the givenBeanFactoryto the createdAspectJExpressionPointcutinstances, for bean pointcut handling as well as consistentClassLoaderresolution.- Parameters:
beanFactory- the BeanFactory to propagate (may benull}- Since:
- 4.3.6
- See Also:
AspectJExpressionPointcut.setBeanFactory(org.springframework.beans.factory.BeanFactory),ConfigurableBeanFactory.getBeanClassLoader()
Method Detail
getAdvisors
public List<Advisor> getAdvisors(MetadataAwareAspectInstanceFactory aspectInstanceFactory)
Description copied from interface:AspectJAdvisorFactoryBuild Spring AOP Advisors for all annotated At-AspectJ methods on the specified aspect instance.- Specified by:
getAdvisorsin interfaceAspectJAdvisorFactory- 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
public Advisor getAdvisor(Method candidateAdviceMethod, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrderInAspect, String aspectName)
Description copied from interface:AspectJAdvisorFactoryBuild a Spring AOP Advisor for the given AspectJ advice method.- Specified by:
getAdvisorin interfaceAspectJAdvisorFactory- Parameters:
candidateAdviceMethod- the candidate advice methodaspectInstanceFactory- the aspect instance factorydeclarationOrderInAspect- the declaration order within the aspectaspectName- the name of the aspect- Returns:
nullif 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
public Advice getAdvice(Method candidateAdviceMethod, AspectJExpressionPointcut expressionPointcut, MetadataAwareAspectInstanceFactory aspectInstanceFactory, int declarationOrder, String aspectName)
Description copied from interface:AspectJAdvisorFactoryBuild a Spring AOP Advice for the given AspectJ advice method.- Specified by:
getAdvicein interfaceAspectJAdvisorFactory- Parameters:
candidateAdviceMethod- the candidate advice methodexpressionPointcut- the AspectJ expression pointcutaspectInstanceFactory- the aspect instance factorydeclarationOrder- the declaration order within the aspectaspectName- the name of the aspect- Returns:
nullif 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