|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.aop.framework.ProxyConfig
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator
org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator
edu.utah.further.core.util.aop.SelectiveAspectJAutoProxyCreator
public class SelectiveAspectJAutoProxyCreator
An extension of AnnotationAwareAspectJAutoProxyCreator
, the aspect behind the
<aop:aspectj-autoproxy> element that scans and advises beans whose names match
any number of specified regular expressions wired to this creator.
That is, while <aop:include> allows specifying which aspects are used by
AnnotationAwareAspectJAutoProxyCreator
, this bean also also allows specifying a
subset of the beans in the application context to be auto-proxied. This is done using
the analogous elements <core:include-bean> within the
<core:aspectj-autoproxy> that hides SelectiveAspectJAutoProxyCreator
's
bean definition. For example, to only proxy beans under the
edu.utah.further
package, use
<core:aspectj-autoproxy> </core:include-bean value="edu\.utah\.further\..+" /> </core:aspectj-autoproxy>
Additionally, this aspect prevents any dynamic CGLIB proxies from being auto-proxied
because they will always trigger the error below when an AspectJ class-level annotation
matching pattern such as @within(edu.utah.further.SomeAnnotationType)
is
used in a point-cut.
This is not only faster, but especially useful in an OSGi setting, because some OSGi
services like pooledConnectionFactory
are dynamic proxies, and crash
AnnotationAwareAspectJAutoProxyCreator
on the error
Caused by: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine annotations of missing type com.springsource.kernel.dmfragment.internal.KernelMBeanExporter [Xlint:cantFindType]
This class was built for extension.
-----------------------------------------------------------------------------------
(c) 2008-2011 FURTHeR Project, Health Sciences IT, University of Utah
Contact: Dr. Scott Narus <scott.narus@hsc.utah.edu>
Biomedical Informatics, 26 South 2000 East
Room 5775 HSEB, Salt Lake City, UT 84112
Day Phone: 1-801-213-3288
-----------------------------------------------------------------------------------
<oren.livne@utah.edu>
https://jira.chpc.utah.edu/browse/FUR-900
,
http://forum.springsource.org/showthread.php?t=85396
,
https://issuetracker.springsource.com/browse/DMS-2390
,
Serialized FormField Summary |
---|
Fields inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator |
---|
DO_NOT_PROXY, logger, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
SelectiveAspectJAutoProxyCreator()
|
Method Summary | |
---|---|
protected List<?> |
findAdvisorsThatCanApply(List candidateAdvisors,
Class beanClass,
String beanName)
Search the given candidate Advisors to find all Advisors that can apply to the specified bean. |
protected List<?> |
findCandidateAdvisors()
Find all candidate Advisors to use in auto-proxying. |
protected Object[] |
getAdvicesAndAdvisorsForBean(Class beanClass,
String beanName,
org.springframework.aop.TargetSource targetSource)
|
protected boolean |
isBeanADynamicProxy(String beanClassName)
Is this class name of a dynamic proxy bean generated by CGLIB. |
protected boolean |
isBeanProxied(String beanClassName)
Is bean eligible for auto-proxying. |
protected boolean |
isEligibleAspectBean(String beanName)
|
protected boolean |
isEligibleBeanForProxying(String beanClassName)
Check whether the given application context bean is eligible for auto-proxying based on inclusion patterns. |
void |
setIncludeBeanPatterns(List<String> patterns)
Set a list of regular expression patterns, matching eligible spring fully-qualified bean names in the application context. |
Methods inherited from class org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator |
---|
initBeanFactory, isInfrastructureClass, setAspectJAdvisorFactory, setIncludePatterns |
Methods inherited from class org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator |
---|
extendAdvisors, shouldSkip, sortAdvisors |
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator |
---|
advisorsPreFiltered, findEligibleAdvisors, isEligibleAdvisorBean, setBeanFactory |
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator |
---|
buildAdvisors, createProxy, customizeProxyFactory, determineCandidateConstructors, getBeanFactory, getCacheKey, getCustomTargetSource, getEarlyBeanReference, getOrder, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInitialization, postProcessBeforeInstantiation, postProcessPropertyValues, predictBeanType, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setBeanClassLoader, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, setOrder, setProxyClassLoader, shouldProxyTargetClass, wrapIfNecessary |
Methods inherited from class org.springframework.aop.framework.ProxyConfig |
---|
copyFrom, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.core.Ordered |
---|
getOrder |
Constructor Detail |
---|
public SelectiveAspectJAutoProxyCreator()
Method Detail |
---|
protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, org.springframework.aop.TargetSource targetSource)
getAdvicesAndAdvisorsForBean
in class org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
public void setIncludeBeanPatterns(List<String> patterns)
Default is to consider all beans as eligible for advice.
patterns
- list of bean inclusion patternsprotected boolean isBeanProxied(String beanClassName)
beanClassName
- fully-qualified class name of prospective bean to be advised
protected boolean isBeanADynamicProxy(String beanClassName)
beanClassName
- fully-qualified class name
true
if and only if the class is thought to be a dynamic CGLIB
proxyprotected boolean isEligibleBeanForProxying(String beanClassName)
If no <core:include-bean> elements were used, then
includeBeanPatterns
will be null
and all beans are included.
If "includePatterns" is non-null, then one of the patterns must match.
beanClassName
- fully-qualified class name of prospective bean to be advised
protected boolean isEligibleAspectBean(String beanName)
isEligibleAspectBean
in class org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator
protected List<?> findCandidateAdvisors()
findCandidateAdvisors
in class org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator
protected List<?> findAdvisorsThatCanApply(List candidateAdvisors, Class beanClass, String beanName)
findAdvisorsThatCanApply
in class org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
candidateAdvisors
- the candidate AdvisorsbeanClass
- the target's bean classbeanName
- the target's bean name
ProxyCreationContext.getCurrentProxiedBeanName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |