@InteractionScope
@InteractionScope is a specialization of Scope @Scope for a component whose lifecycle is bound to the current top-level Interaction, in other words that it is private to the "current user".
Specifically, @InteractionScope is a composed annotation that acts as a shortcut for @Scope("interaction") .
@InteractionScope may be used as a meta-annotation to create custom composed annotations.
API
@interface InteractionScope {
String SCOPE_NAME;
@AliasFor(annotation = Scope.class)
ScopedProxyMode proxyMode() default ScopedProxyMode.TARGET_CLASS; (1)
}
1 | proxyMode
Alias for Scope#proxyMode . |
Members
proxyMode
Alias for Scope#proxyMode .
Defaults to ScopedProxyMode#TARGET_CLASS .
A number of the built-in domain services uses this annotation, including Scratchpad and QueryResultsCache.
You may find that these services must be injected using the Provider
idiom, not directly.
For example:
@DomainService
public class SomeRepository {
// ...
@Inject Provider<QueryResultsCache> queryResultsCacheProvider;
}
If you forget to do this, then the framework will fail-fast with a suitable error message.