spring-framework / org.springframework.aop.support / DelegatePerTargetObjectIntroductionInterceptor

DelegatePerTargetObjectIntroductionInterceptor

open class DelegatePerTargetObjectIntroductionInterceptor : IntroductionInfoSupport, IntroductionInterceptor

Convenient implementation of the org.springframework.aop.IntroductionInterceptor interface.

This differs from DelegatingIntroductionInterceptor in that a single instance of this class can be used to advise multiple target objects, and each target object will have its own delegate (whereas DelegatingIntroductionInterceptor shares the same delegate, and hence the same state across all targets).

The suppressInterface method can be used to suppress interfaces implemented by the delegate class but which should not be introduced to the owning AOP proxy.

An instance of this class is serializable if the delegates are.

Note: There are some implementation similarities between this class and DelegatingIntroductionInterceptor that suggest a possible refactoring to extract a common ancestor class in the future.

Author
Adrian Colyer

Author
Juergen Hoeller

Since
2.0

See Also
#suppressInterfaceDelegatingIntroductionInterceptor

Constructors

<init>

DelegatePerTargetObjectIntroductionInterceptor(defaultImplType: Class<*>, interfaceType: Class<*>)

Functions

invoke

open fun invoke(mi: MethodInvocation): Any

Subclasses may need to override this if they want to perform custom behaviour in around advice. However, subclasses should invoke this method, which handles introduced interfaces and forwarding to the target.