public final class GuiceLifecycleContainers extends Object
Modifier and Type | Method and Description |
---|---|
static <C extends LifecycleContainer> |
initialize(C container,
List<com.google.inject.Module> modules)
Creates a
LifecycleInjector and injects members on the lifecycle container. |
public static <C extends LifecycleContainer> LifecycleInjector initialize(C container, List<com.google.inject.Module> modules)
LifecycleInjector
and injects members on the lifecycle container.
This method is useful for initializing a lifecycle container and getting a
LifecycleInjector
that can be used at the end of the containers lifecycle for shutting
down components by calling LifecycleInjector.shutdown()
.
In addition to the modules
provided to this method, additional modules will also be
installed to configure lifecycle management. After this method executes, all injectable fields
and methods on the container
will be present, unless nullable, and all eager singletons
will be created and initialized.
C
- the type of the containercontainer
- the container that will manage the lifecyclemodules
- the Guice modules to use during the lifecycle of the containerLifecycleInjector
using the provided modules
and additional lifecycle
management modulesCopyright © 2018 Cerner Innovation, Inc.. All rights reserved.