public interface TargetSource extends TargetClassAware
TargetSourceis used to obtain the current "target" of an AOP invocation, which will be invoked via reflection if no around advice chooses to end the interceptor chain itself.
TargetSource is "static", it will always return
the same target, allowing optimizations in the AOP framework. Dynamic
target sources can support pooling, hot swapping, etc.
Application developers don't usually need to work with
TargetSources directly: this is an AOP framework interface.
|Modifier and Type||Method and Description|
Return a target instance.
Return the type of targets returned by this
Will all calls to
Release the given target object obtained from the
@Nullable Class<?> getTargetClass()
null, although certain usages of a
might just work with a predetermined target class.
getTarget()return the same object?
In that case, there will be no need to invoke
and the AOP framework can cache the return value of
trueif the target is immutable
@Nullable Object getTarget() throws Exception
nullif there is no actual target instance
Exception- if the target object can't be resolved
void releaseTarget(Object target) throws Exception
getTarget()method, if any.
target- object obtained from a call to
Exception- if the object can't be released