下面列出了com.google.inject.Binder#requireExactBindingAnnotations ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void configure(final Binder binder) {
binder.disableCircularProxies();
binder.requireExplicitBindings();
binder.requireExactBindingAnnotations();
binder.requireAtInjectOnConstructors();
}
@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);
}