Top Description Fields Methods
org.springframework.aop

public Interface Advisor

Known Direct Subinterfaces
org.springframework.aop.IntroductionAdvisor, org.springframework.aop.PointcutAdvisor
Known Direct Implementers
org.springframework.aop.framework.AdvisedSupport.AdvisorKeyEntry, org.springframework.aop.framework.ProxyFactoryBean.PrototypePlaceholderAdvisor
Imports
org.aopalliance.aop.Advice

Base interface holding AOP advice (action to take at a joinpoint) and a filter determining the applicability of the advice (such as a pointcut). This interface is not for use by Spring users, but to allow for commonality in support for different types of advice.

Spring AOP is based around around advice delivered via method interception, compliant with the AOP Alliance interception API. The Advisor interface allows support for different types of advice, such as before and after advice, which need not be implemented using interception.

Authors
Rod Johnson, Juergen Hoeller

Field Summary

Modifier and TypeField and Description
public static final Advice
EMPTY_ADVICE

Common placeholder for an empty Advice to be returned from getAdvice() if no proper advice has been configured (yet).

Method Summary

Modifier and TypeMethod and Description
public Advice

Returns:

the advice that should apply if the pointcut matches
getAdvice
()

Return the advice part of this aspect.

public default boolean

Returns:

whether this advice is associated with a particular target instance
isPerInstance
()

Return whether this advice is associated with a particular instance (for example, creating a mixin) or shared with all instances of the advised class obtained from the same Spring bean factory.

Field Detail

EMPTY_ADVICEback to summary
public static final Advice EMPTY_ADVICE

Common placeholder for an empty Advice to be returned from getAdvice() if no proper advice has been configured (yet).

Since
5.0

Method Detail

getAdviceback to summary
public Advice getAdvice()

Return the advice part of this aspect. An advice may be an interceptor, a before advice, a throws advice, etc.

Returns:Advice

the advice that should apply if the pointcut matches

See Also
org.aopalliance.intercept.MethodInterceptor, BeforeAdvice, ThrowsAdvice, AfterReturningAdvice
isPerInstanceback to summary
public default boolean isPerInstance()

Return whether this advice is associated with a particular instance (for example, creating a mixin) or shared with all instances of the advised class obtained from the same Spring bean factory.

Note that this method is not currently used by the framework. Typical Advisor implementations always return true. Use singleton/prototype bean definitions or appropriate programmatic proxy creation to ensure that Advisors have the correct lifecycle model.

As of 6.0.10, the default implementation returns true.

Returns:boolean

whether this advice is associated with a particular target instance