The Spring Framework

org.springframework.aop.aspectj.annotation
Class AnnotationAwareAspectJAutoProxyCreator

java.lang.Object
  extended by org.springframework.aop.framework.ProxyConfig
      extended by org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
          extended by org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
              extended by org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator
                  extended by org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator
All Implemented Interfaces:
Serializable, BeanFactoryAware, BeanPostProcessor, InstantiationAwareBeanPostProcessor, Ordered

public class AnnotationAwareAspectJAutoProxyCreator
extends AspectJAwareAdvisorAutoProxyCreator

AspectJAwareAdvisorAutoProxyCreator subclass that processes all AspectJ annotation classes in the current application context, as well as Spring Advisors.

Any AspectJ annotated classes will automatically be recognized, and their advice applied if Spring AOP's proxy-based model is capable of applying it. This covers method execution joinpoints.

If the <aop:include> element is used, only @AspectJ beans with names matched by an include pattern will be considered as defining aspects to use for Spring autoproxying.

Processing of Spring Advisors follows the rules established in DefaultAdvisorAutoProxyCreator.

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller
See Also:
DefaultAdvisorAutoProxyCreator, AspectJAdvisorFactory, Serialized Form

Field Summary
 
Fields inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
DO_NOT_PROXY, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
 
Fields inherited from class org.springframework.aop.framework.ProxyConfig
exposeProxy, logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
AnnotationAwareAspectJAutoProxyCreator()
           
 
Method Summary
protected  List<Advisor> createAspectJAdvisors(AspectJAdvisorFactory aspectJAdvisorFactory, ListableBeanFactory beanFactory)
          Look for AspectJ annotated aspect classes in the current bean factory, and return to a list of Spring AOP advisors representing them.
protected  List findCandidateAdvisors()
          Find all candidate advisors to use in auto-proxying.
protected  boolean isInfrastructureClass(Class beanClass)
          Return whether the given bean class represents an infrastructure class that should never be proxied.
 void setAspectJAdvisorFactory(AspectJAdvisorFactory aspectJAdvisorFactory)
           
 void setIncludePatterns(List<String> patterns)
           
 
Methods inherited from class org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator
extendAdvisors, sortAdvisors
 
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
findEligibleAdvisors, getAdvicesAndAdvisorsForBean, isEligibleAdvisorBean
 
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
createProxy, customizeProxyFactory, getBeanFactory, getCustomTargetSource, getOrder, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInitialization, postProcessBeforeInstantiation, postProcessPropertyValues, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setBeanFactory, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, setOrder, shouldSkip
 
Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, getAopProxyFactory, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setAopProxyFactory, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotationAwareAspectJAutoProxyCreator

public AnnotationAwareAspectJAutoProxyCreator()
Method Detail

isInfrastructureClass

protected boolean isInfrastructureClass(Class beanClass)
Description copied from class: AbstractAutoProxyCreator
Return whether the given bean class represents an infrastructure class that should never be proxied.

Default implementation considers Advisors, Advices and AbstractAutoProxyCreators as infrastructure classes.

Overrides:
isInfrastructureClass in class AbstractAutoProxyCreator
Parameters:
beanClass - the class of the bean
Returns:
whether the bean represents an infrastructure class
See Also:
Advisor, MethodInterceptor, AbstractAutoProxyCreator.shouldSkip(java.lang.Class, java.lang.String)

setAspectJAdvisorFactory

public void setAspectJAdvisorFactory(AspectJAdvisorFactory aspectJAdvisorFactory)

setIncludePatterns

public void setIncludePatterns(List<String> patterns)

findCandidateAdvisors

protected List findCandidateAdvisors()
Description copied from class: AbstractAdvisorAutoProxyCreator
Find all candidate advisors to use in auto-proxying.

Overrides:
findCandidateAdvisors in class AbstractAdvisorAutoProxyCreator
Returns:
list of candidate Advisors

createAspectJAdvisors

protected List<Advisor> createAspectJAdvisors(AspectJAdvisorFactory aspectJAdvisorFactory,
                                              ListableBeanFactory beanFactory)
                                       throws BeansException,
                                              IllegalStateException
Look for AspectJ annotated aspect classes in the current bean factory, and return to a list of Spring AOP advisors representing them. Create a Spring Advisor for each advice method

Parameters:
aspectJAdvisorFactory - the AdvisorFactory to use
beanFactory - the BeanFactory to look for AspectJ annotated aspects in
Returns:
a list of Spring AOP advisors resulting from AspectJ annotated classes in the current Spring bean factory
Throws:
BeansException
IllegalStateException

The Spring Framework

Copyright © 2002-2006 The Spring Framework.