@Override protected Injector newInjector(BootstrapModule... applicableBootstrapModules) { return LifecycleInjector.bootstrap(mainClass, applicableBootstrapModules); } }
@Override protected Injector newInjector(BootstrapModule... applicableBootstrapModules) { return LifecycleInjector.bootstrap(mainClass, applicableBootstrapModules); } }
@Override protected Injector newInjector(LifecycleInjectorBuilderSuite... applicableSuites) { return LifecycleInjector.bootstrap(mainClass, applicableSuites); } }
public static Injector bootstrap(final Class<?> main) { return bootstrap(main, (Module)null); }
public static Injector bootstrap(final Class<?> main, final BootstrapModule... externalBootstrapModules) { return bootstrap(main, null, externalBootstrapModules); }
public static void main(final String args[]) { try { Class<?> mainClass = Class.forName(args[0]); LifecycleInjector.bootstrap(mainClass, new AbstractModule() { @Override protected void configure() { bind(Arguments.class).toInstance(new Arguments(args)); } }); } catch (Exception e) { throw new ProvisionException("Error instantiating main class", e); } } }
public void start() throws Exception { List<BootstrapModule> bootstrapModules = new ArrayList<>(); bootstrapModules.add(new BootstrapModule() { @Override public void configure(BootstrapBinder binder) { if (config == null) { bindConfigurationProvider(binder); } binder.include(KaryonWebAdminModule.class); binder.include(KaryonServoModule.class); binder.include(new AbstractModule() { @Override protected void configure() { // TODO: replace fake health check with a real one. bind(HealthCheckHandler.class).to(AlwaysHealthyHealthCheck.class).asEagerSingleton(); bind(HealthCheckInvocationStrategy.class).to(SyncHealthCheckInvocationStrategy.class).asEagerSingleton(); } }); } }); additionalModules(bootstrapModules); injector = LifecycleInjector.bootstrap( this.getClass(), bootstrapModules.toArray(new BootstrapModule[bootstrapModules.size()]) ); startLifecycleManager(); }