-
Notifications
You must be signed in to change notification settings - Fork 179
Auto Binding
Deprecated
@AutoBindSingleton is deprecated in favor of using bindings in Guice modules. @AutoBindSingleton has been the source of numerous problems since it frequently results in unwanted classes being instantiated. Furthermore, @AutoBindSingleton is misleading since it is not a proper Guice scope. For example, any @AutoBindSingleton annotated class that does not also have the @Singleton annotation does not exhibit singleton behavior when that class was not pulled in via classpath scanning.
Using Guice’s modules to add bindings can be cumbersome and tedious. It’s also unnecessary for most simple types of binding. Governator can scan your CLASSPATH to do “auto binding”. There are two types of auto binding supported:
- AutoBindSingleton
- AutoBind (for injected arguments/fields)
Governator will only scan configured packages from the CLASSPATH. Set the packages to use with the usingBasePackages()
method of the LifecycleInjectorBuilder
.
See the wiki for AutoBindSingleton or AutoBind for details.
- 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