@Documented @Retention(value=RUNTIME) @Target(value={ANNOTATION_TYPE,TYPE,METHOD}) @InterceptorBinding(kind=AROUND) public @interface Around
Annotation stereotype to applied to other annotations to indicate the annotation provides Around advice.
Around advice decorates a method invocation such that the method can be intercepted via a MethodInterceptor
For example:
@Around
@Type(ExampleInterceptor.class)
@Documented
@Retention(RUNTIME)
public @interface Example {
}
Note that the annotation MUST be RetentionPolicy.RUNTIME
and the specified Type
must implement MethodInterceptor
Modifier and Type | Optional Element and Description |
---|---|
boolean |
cacheableLazyTarget
If true the proxy cache and reuse the target.
|
boolean |
hotswap
If
proxyTarget() is set to true then one can optionally set the value of hotswap to true
in which case the proxy will implement the HotSwappableInterceptedProxy interface. |
boolean |
lazy
By default Micronaut will initialize the proxy target eagerly when the proxy is created.
|
boolean |
proxyTarget
By default Micronaut will compile subclasses of the target class and call super.foo(..) to invoke the original method since
this is more efficient and allows proxied methods to work for calls from within the class.
|
Around.ProxyTargetConstructorMode |
proxyTargetMode
Sets the
Around.ProxyTargetConstructorMode . |
public abstract boolean proxyTarget
By default Micronaut will compile subclasses of the target class and call super.foo(..) to invoke the original method since this is more efficient and allows proxied methods to work for calls from within the class.
However certain cases it may be useful to be able to to instead proxy all public methods of the original implementation.
By setting the value here to true
the Interceptor
can specify that it requires proxying of the class
Generated subclasses will implement InterceptedProxy
if this attribute is set to true
InterceptedProxy
public abstract boolean hotswap
If proxyTarget()
is set to true
then one can optionally set the value of hotswap
to true
in which case the proxy will implement the HotSwappableInterceptedProxy
interface.
HotSwappableInterceptedProxy
public abstract boolean lazy
By default Micronaut will initialize the proxy target eagerly when the proxy is created. This is better for performance, but some use cases may require the bean to be resolved lazily (for example for resolving the bean from a custom scope).
If proxyTarget()
is set to true
then one can optionally set the of lazy
to true
public abstract boolean cacheableLazyTarget
public abstract Around.ProxyTargetConstructorMode proxyTargetMode
Around.ProxyTargetConstructorMode
. See the
javadoc for Around.ProxyTargetConstructorMode
for more information.Around.ProxyTargetConstructorMode
.Around.ProxyTargetConstructorMode