Skip to content

Instantly share code, notes, and snippets.

@edewit
Created May 9, 2019 14:21
Show Gist options
  • Save edewit/c6c223faab13b219d611b13fdd2ee0c6 to your computer and use it in GitHub Desktop.
Save edewit/c6c223faab13b219d611b13fdd2ee0c6 to your computer and use it in GitHub Desktop.
Injector injector = pluginInjector.createChildInjector(binder -> {
binder.bind(PluginInstance.class).toInstance(plugin);
binder.bind(TokenProvider.class).to(TokenProviderImpl.class);
binder.bind(Minecraft.class).to(MinecraftImpl.class);
binder.bind(EventBusSender.class).to(MinecraftVerticle.class);
binder.bind(EventService.class);
binder.bind(new TypeLiteral<Handler<Message<JsonObject>>>(){}).to(ActionsConsumer.class);
binder.bind(ConditionService.class);
binder.bind(StaticWebServerVerticle.class);
// TODO read from some configuration
binder.bind(Integer.class).annotatedWith(Names.named("http-port")).toInstance(8080);
binder.bind(Integer.class).annotatedWith(Names.named("web-http-port")).toInstance(7070);
});
MinecraftVerticle minecraftVerticle = injector.getInstance(MinecraftVerticle.class);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment