Skip to content

Instantly share code, notes, and snippets.

@bitbrain
Created October 7, 2014 14:05
Show Gist options
  • Save bitbrain/d04fa8b034c9aa2fd414 to your computer and use it in GitHub Desktop.
Save bitbrain/d04fa8b034c9aa2fd414 to your computer and use it in GitHub Desktop.
package de.bitbrain.guice;
import com.google.inject.AbstractModule;
import com.google.inject.matcher.Matchers;
import com.google.inject.name.Names;
public class FooBarModule extends AbstractModule {
@Override
protected void configure() {
StateScope scope = new StateScope();
bindScope(StateScoped.class, scope);
bind(StateScope.class)
.annotatedWith(Names.named("stateScope"))
.toInstance(scope);
bind(StateHandler.class).asEagerSingleton();
bind(FooState.class);
bind(BarState.class);
bind(Renderer.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment