public final class SpectatorModule
extends com.google.inject.AbstractModule
TestModule. Typical usage:
User code
public class Foo {
private final Counter counter;
@Inject
public Foo(ExtendedRegistry registry) {
counter = registry.counter("foo.doSomething");
}
public void doSomething() {
counter.increment();
}
}
Governator
One of the classes requires an PostConstruct block to initialize
so governator should be used to manage the lifecycle as guice doesn't support it directly.
Injector injector = LifecycleInjector.builder() .withModules(new SpectatorModule()) .build() .createInjector(); injector.getInstance(LifecycleManager.class).start();
| Constructor and Description |
|---|
SpectatorModule() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure() |
boolean |
equals(Object obj) |
int |
hashCode() |
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding