Spring Security Framework

Class MethodDefinitionSourceAdvisor

  extended by org.springframework.aop.support.AbstractPointcutAdvisor
      extended by org.springframework.security.intercept.method.aopalliance.MethodDefinitionSourceAdvisor
All Implemented Interfaces:
Serializable, Advisor, PointcutAdvisor, BeanFactoryAware, Ordered

public class MethodDefinitionSourceAdvisor
extends AbstractPointcutAdvisor
implements BeanFactoryAware

Advisor driven by a MethodDefinitionSource, used to exclude a MethodSecurityInterceptor from public (ie non-secure) methods.

Because the AOP framework caches advice calculations, this is normally faster than just letting the MethodSecurityInterceptor run and find out itself that it has no work to do.

This class also allows the use of Spring's DefaultAdvisorAutoProxyCreator, which makes configuration easier than setup a ProxyFactoryBean for each object requiring security. Note that autoproxying is not supported for BeanFactory implementations, as post-processing is automatic only for application contexts.

Based on Spring's TransactionAttributeSourceAdvisor.

Ben Alex
See Also:
Serialized Form

Field Summary
Fields inherited from interface org.springframework.core.Ordered
Constructor Summary
MethodDefinitionSourceAdvisor(MethodSecurityInterceptor advice)
          Deprecated. use the decoupled approach instead
MethodDefinitionSourceAdvisor(String adviceBeanName, MethodDefinitionSource attributeSource)
          Alternative constructor for situations where we want the advisor decoupled from the advice.
Method Summary
 org.aopalliance.aop.Advice getAdvice()
 Pointcut getPointcut()
 void setBeanFactory(BeanFactory beanFactory)
Methods inherited from class org.springframework.aop.support.AbstractPointcutAdvisor
equals, getOrder, hashCode, isPerInstance, setOrder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public MethodDefinitionSourceAdvisor(MethodSecurityInterceptor advice)
Deprecated. use the decoupled approach instead


public MethodDefinitionSourceAdvisor(String adviceBeanName,
                                     MethodDefinitionSource attributeSource)
Alternative constructor for situations where we want the advisor decoupled from the advice. Instead the advice bean name should be set. This prevents eager instantiation of the interceptor (and hence the AuthenticationManager). See SEC-773, for example.

This is essentially the approach taken by subclasses of AbstractBeanFactoryPointcutAdvisor, which this class should extend in future. The original hierarchy and constructor have been retained for backwards compatibility.

adviceBeanName - name of the MethodSecurityInterceptor bean
attributeSource - the attribute source (should be the same as the one used on the interceptor)
Method Detail


public Pointcut getPointcut()
Specified by:
getPointcut in interface PointcutAdvisor


public org.aopalliance.aop.Advice getAdvice()
Specified by:
getAdvice in interface Advisor


public void setBeanFactory(BeanFactory beanFactory)
                    throws BeansException
Specified by:
setBeanFactory in interface BeanFactoryAware

Spring Security Framework

Copyright © 2004-2010 SpringSource, Inc. All Rights Reserved.