Interface Scope

All Known Implementing Classes:
MojoExecutionScope, MojoExecutionScope, SessionScope, SessionScope

@Experimental public interface Scope
A Scope defines how visible instances are when managed by a Injector. Typically, instances are created with no scope, meaning they don’t retain any state from the framework’s perspective: the Injector generates the instance, injects it into the necessary class, and then immediately forgets it. By linking a scope to a specific binding, the created instance can be “remembered” and reused for future injections.

Instances are associated to a given scope by means of a @Scope annotation, usually put on another annotation. For example, the @Singleton annotation is used to indicate that a given binding should be scoped as a singleton.

The following scopes are currently supported:

Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> Supplier<T>
    scope(Key<T> key, Supplier<T> unscoped)