The tests in this demo project are meant to explain common usage and corner cases of Guice binding, autowiring, etc.
This is the suggested running order:
-
- ProvidingStrategiesDemo: showcases guice module examples, and different strategies to provide collaborators
- ProvidingEquivalenceDemos: showcases equivalent alternatives to provide a single collaborator
- SingletonDemo: Different ways to provide a collaborator as singleton (or not)
- MoreSingletonExamples: expands the use of Singleton providing
- SetProvidingStrategies: on how to provide multiple implementations of an interface, grouped into sets
- MapProvidingStrategies: on how to provide multiple implementations of an interface, grouped into a map, indexed by key
- NamedDemo: when you have to provide multiple implementations of a common interface, and you need to choose which one to use
- ConcreteBindingDemo: Demonstrate how to bind concrete classes, without relying on an interface
- ImplicitInjectionDemo: Provided objects are automatically passed to other providing methods (a.k.a.: Linked Binding)
- ProviderTest: Showcases the initialization sequence when using custom providers
-
- ConstructorInjectionDemo: Different constructor injection examples
- FieldInjectionDemo: Different field injection examples
-
- OverrideDemo: how to override provided implementation by using modules override
-
- InstantiationTimeDemo: When is a provided binding actually instantiated?
- WiringValidationDemo: explains why you should always use Stage.PRODUCTION to validate your wiring