Class Scope<T>

java.lang.Object
io.inverno.mod.base.Scope<T>
Type Parameters:
T - the type of the scoped instances
Direct Known Subclasses:
KeyScope, ReactorScope, ThreadScope

public abstract class Scope<T> extends Object

A scope can be used to define a bean which allows to create and retrieve different bean instances depending on a particular scope.

It is then possible to create instances using DI for a particular context. This context can be anything from the current thread or specified by an arbitrary key.

A typical Scope implementation typically relies on prototype beans injected lazily to benefit from dependency injection but they can also be designed as a regular factories.

Since:
1.2
Author:
Jeremy Kuhn
  • Constructor Details

    • Scope

      public Scope()
  • Method Details

    • create

      protected abstract T create()

      Creates a scoped instance.

      Returns:
      an instance