Until now, we have used the word "target" to define the object that receives the calls from a caller object, where a proxy was interposed to add logic contained in advices.
In this interposition mechanism, Spring puts at our disposal the interface org.springframework.aop.TargetSource
, which returns the object target
.
public interface TargetSource { Class getTargetClass(); boolean isStatic(); Object getTarget() throws Exception; void releaseTarget(Object target) throws Exception; }
This interface is interesting as it permits target pooling and hot swapping.
Without specifying the targetSource
, the default implementation that wraps the local object is returned and also the target is returned for all the following invocations.