Java Code Examples for com.google.inject.Binder#requireExactBindingAnnotations()

The following examples show how to use com.google.inject.Binder#requireExactBindingAnnotations() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiceBundle.java    From dropwizard-guicier with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(final Binder binder) {
  binder.disableCircularProxies();
  binder.requireExplicitBindings();
  binder.requireExactBindingAnnotations();
  binder.requireAtInjectOnConstructors();
}
 
Example 2
Source File: BaragonAgentServiceModule.java    From Baragon with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(Binder binder) {
  binder.requireExplicitBindings();
  binder.requireExactBindingAnnotations();
  binder.requireAtInjectOnConstructors();

  binder.install(new BaragonDataModule());
  binder.install(new BargonAgentResourcesModule());

  // Healthchecks
  binder.bind(LoadBalancerHealthcheck.class).in(Scopes.SINGLETON);
  binder.bind(ZooKeeperHealthcheck.class).in(Scopes.SINGLETON);
  binder.bind(ConfigChecker.class).in(Scopes.SINGLETON);

  // Managed
  binder.bind(BaragonAgentGraphiteReporterManaged.class).asEagerSingleton();
  binder.bind(BootstrapManaged.class).asEagerSingleton();
  binder.bind(LifecycleHelper.class).asEagerSingleton();

  // Manager
  binder.bind(AgentRequestManager.class).in(Scopes.SINGLETON);

  binder.bind(ResyncListener.class).in(Scopes.SINGLETON);
  binder.bind(LocalLbAdapter.class).in(Scopes.SINGLETON);
  binder.bind(LbConfigGenerator.class).in(Scopes.SINGLETON);
  binder.bind(ServerProvider.class).in(Scopes.SINGLETON);
  binder.bind(FilesystemConfigHelper.class).in(Scopes.SINGLETON);
  binder.bind(AgentHeartbeatWorker.class).in(Scopes.SINGLETON);
  binder.bind(InternalStateChecker.class).in(Scopes.SINGLETON);
  binder.bind(DirectoryChangesListener.class).in(Scopes.SINGLETON);

  final ObjectMapper objectMapper = new ObjectMapper();

  objectMapper.registerModule(new GuavaModule());
  objectMapper.registerModule(new Jdk8Module());

  binder.bind(ObjectMapper.class).toInstance(objectMapper);
}