接口 AdvisorAdapterRegistry
- 所有已知实现类:
DefaultAdvisorAdapterRegistry
public interface AdvisorAdapterRegistry
Interface for registries of Advisor adapters.This is an SPI interface, not to be implemented by any Spring user.
- 作者:
- Rod Johnson, Rob Harrop
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 MethodInterceptor[]
getInterceptors(Advisor advisor)
Return an array of AOP Alliance MethodInterceptors to allow use of the given Advisor in an interception-based framework.void
registerAdvisorAdapter(AdvisorAdapter adapter)
Register the givenAdvisorAdapter
.Advisor
wrap(Object advice)
Return anAdvisor
wrapping the given advice.
方法详细资料
wrap
Advisor wrap(Object advice) throws UnknownAdviceTypeException
Return anAdvisor
wrapping the given advice.Should by default at least support
MethodInterceptor
,MethodBeforeAdvice
,AfterReturningAdvice
,ThrowsAdvice
.- 参数:
advice
- object that should be an advice- 返回:
- an Advisor wrapping the given advice (never
null
; if the advice parameter is an Advisor, it is to be returned as-is) - 抛出:
UnknownAdviceTypeException
- if no registered advisor adapter can wrap the supposed advice
getInterceptors
MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdviceTypeException
Return an array of AOP Alliance MethodInterceptors to allow use of the given Advisor in an interception-based framework.Don't worry about the pointcut associated with the
Advisor
, if it is aPointcutAdvisor
: just return an interceptor.- 参数:
advisor
- Advisor to find an interceptor for- 返回:
- an array of MethodInterceptors to expose this Advisor's behavior
- 抛出:
UnknownAdviceTypeException
- if the Advisor type is not understood by any registered AdvisorAdapter
registerAdvisorAdapter
void registerAdvisorAdapter(AdvisorAdapter adapter)
Register the givenAdvisorAdapter
. Note that it is not necessary to register adapters for an AOP Alliance Interceptors or Spring Advices: these must be automatically recognized by anAdvisorAdapterRegistry
implementation.- 参数:
adapter
- AdvisorAdapter that understands particular Advisor or Advice types