Protected
Protected

Guice Integration


Module stability: STABLE

All Active Objects supports dependency injection using Guice annotations (such as ‘@Inject’ etc.).
The ‘ActiveObjectManager’ class understands Guice and will do the wiring for you.

External Guice modules


You can also plug in external Guice modules and have non-active objects wired up as part of the configuration.
Here is an example:
conf.addExternalGuiceModule(new AbstractModule() {
  protected void configure() {
    bind(Ext.class).to(ExtImpl.class).in(Scopes.SINGLETON);
  }
}).configureActiveObjects(
  ...// as above
).inject().supervise();

Retrieve the external Guice dependency


The external dependency can be retrieved like this:
Ext ext = conf.getExternalDependency(Ext.class);
Home
close
Loading...
Home Turn Off "Getting Started"
close
Loading...