-
Notifications
You must be signed in to change notification settings - Fork 179
Bootstrapping
Randgalt edited this page Aug 16, 2012
·
25 revisions
Governator creates two Guice injectors: an internal “bootstrapping” Injector and the main application Injector. The main Injector is created when you call LifecycleInjectorBuilder.createInjector()
. The bootstrapping injector is created internally by Governator.
Several Governator features introduce recursive dependencies. Asset loading and configuration mapping require AssetLoader
and ConfigurationProvider
instances. These instances are needed as the main Injector is being created (i.e. as Guice is creating instances).
Bootstrapping is part of the classpath scanning step:
- Classes annotated with @RequiredAsset are examined to determine the specified AssetLoader class. A singleton binding is added to the bootstrap Injector for this AssetLoader.
- ConfigurationProvider and AssetLoader classes annotated with @AutoBindSingleton are detected and bound into the bootstrap Injector.
- Any application specific bootstrap binding is done via the specified bootstrap module (if any).
You can specify your own bootstrap bindings if needed by specifying a bootstrap module:
LifecycleInjector.builder().withBootstrapModule(yourBootstrapModule)
- Home
- Getting Started
- Bootstrapping
- Lifecycle Management
- Auto Binding
- Module-Dependencies
- Warm Up
- Configuration Mapping
- Field Validation
- Lazy Singleton
- Concurrent Singleton
- Generic Binding Annotations
- LifecycleListener
- Governator Phases
- Grapher Integration
- JUnit Testing
- FAQ
- Best Practices
- Spring, PicoContainer, Etc.
- Javadoc
- End-to-End Examples