ActivationProvisionListener implements ActivationLifecycle, ProvisionListener { @Override public void activate() { long startTime = System.currentTimeMillis(); logger.info("Activating services"); services.forEach(ServiceHolder::activate); this.activationTime = System.currentTimeMillis() - startTime; logger.info("Service activation finished in {}[ms]", activationTime); }  @Override void onProvision(ProvisionInvocation<T> provision); @Override boolean isActive(T instance); @Override void activate(); @Override void deactivate(); @Override long getActivationTimeMs(); @Override List<Pair<String, Long>> getServiceActionTimesMs();  }
@Test public void testServiceReordering() throws Exception { LifecycleInjector injector = InjectorBuilder.fromModules( new ContainerEventBusModule(), new AbstractModule() { @Override protected void configure() { bind(TitusRuntime.class).toInstance(TitusRuntimes.internal()); bind(ActivationProvisionListenerTest.class).toInstance(ActivationProvisionListenerTest.this); bind(ServiceB.class).asEagerSingleton(); bind(ServiceA.class).asEagerSingleton(); } }).createInjector(); ActivationLifecycle activationLifecycle = injector.getInstance(ActivationLifecycle.class); activationLifecycle.activate(); assertThat(activationTrace).containsExactlyInAnyOrder( Pair.of("serviceA", "ACTIVATED"), Pair.of("serviceB", "ACTIVATED") ); }