Skip to content

Instantly share code, notes, and snippets.

@dlemures
Last active May 16, 2016 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlemures/8d4ee4fa163a1a475802217a2c7a385a to your computer and use it in GitHub Desktop.
Save dlemures/8d4ee4fa163a1a475802217a2c7a385a to your computer and use it in GitHub Desktop.
public class SmoothieShopModule extends Module {
public SmoothieShopModule() {
bind(Blender.class).to(JarBlender.class); // Blender -> JarBlender
bind(Freezer.class).to(new Freezer()); // Freezer -> Freezer instance
}
}
class SmoothieShop {
@Inject SmoothieMaker smoothieMaker1;
@Inject SmoothieMaker smoothieMaker2;
public SmoothieShop() {
Scope scope = Toothpick.openScope("SmoothieShop");
scope.installModule(new SmoothieShopModule());
Toothpick.inject(this, scope);
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment