Skip to content

Governator Phases

Randgalt edited this page Aug 21, 2012 · 15 revisions

Guice users are familiar with the “binding phase” where Guice calls your modules to register bindings. You then create the Injector as a second phase. Governator introduces several new phases. The timeline is like this:

  1. Classpath scanning phase
    • Specified packages are scanned for Governator annotations
    • The classes are stored for later phases
  2. Bootstrapping phase
    • Application bootstrap modules are invoked
    • Auto bind ConfigurationProviders are bound
    • The LifecycleManager is created via the bootstrap Injector
  3. Main Injector phase
    • Application provided modules are added
    • AutoBindSingletons are bound
    • The main Injector is created
    • As each object is created by Guice:
      1. Configuration values are set
      2. PostConstruct methods are called
  4. Start phase
    • The application calls LifecycleManager.start()
    • Bean/field validation is done
    • Any WarmUp methods are executed in background threads