Annotation Type Around
-
@Documented @Retention(RUNTIME) @Target({ANNOTATION_TYPE,TYPE,METHOD}) @InterceptorBinding(kind=AROUND) public @interface AroundAnnotation 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
MethodInterceptorFor example:
@Around @Type(ExampleInterceptor.class) @Documented @Retention(RUNTIME) public @interface Example { }Note that the annotation MUST be
RetentionPolicy.RUNTIMEand the specifiedTypemust implementMethodInterceptor- Since:
- 1.0
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleancacheableLazyTargetIf true the proxy cache and reuse the target.booleanhotswapIfproxyTarget()is set totruethen one can optionally set the value ofhotswapto true in which case the proxy will implement theHotSwappableInterceptedProxyinterface.booleanlazyBy default Micronaut will initialize the proxy target eagerly when the proxy is created.booleanproxyTargetBy 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.ProxyTargetConstructorModeproxyTargetModeSets theAround.ProxyTargetConstructorMode.
-
-
-
Element Detail
-
proxyTarget
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
truetheInterceptorcan specify that it requires proxying of the classGenerated subclasses will implement
InterceptedProxyif this attribute is set to true- Returns:
- True if the original implementation should be proxied. Defaults to false.
- See Also:
InterceptedProxy
- Default:
- false
-
-
-
hotswap
boolean hotswap
If
proxyTarget()is set totruethen one can optionally set the value ofhotswapto true in which case the proxy will implement theHotSwappableInterceptedProxyinterface.- Returns:
- True if the proxy should allow hotswap
- See Also:
HotSwappableInterceptedProxy
- Default:
- false
-
-
-
lazy
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 totruethen one can optionally set the oflazyto true- Returns:
- True if the proxy target should be resolved lazily
- Default:
- false
-
-
-
proxyTargetMode
Around.ProxyTargetConstructorMode proxyTargetMode
Sets theAround.ProxyTargetConstructorMode. See the javadoc forAround.ProxyTargetConstructorModefor more information.- Returns:
- The
Around.ProxyTargetConstructorMode. - Since:
- 3.0.0
- See Also:
Around.ProxyTargetConstructorMode
- Default:
- io.micronaut.aop.Around.ProxyTargetConstructorMode.ERROR
-
-