Google Guice Tutorial
Selected Reading
- Guice - Discussion
- Guice - Useful Resources
- Guice - Quick Guide
- Guice - AOP
- Guice - Scopes
- Guice - On-demand Injection
- Guice - Optional Injection
- Guice - Field Injection
- Guice - Method Injection
- Guice - Constructor Injection
- Guice - Just-in-time Bindings
- Guice - Inbuilt Bindings
- Guice - Constructor Bindings
- Guice - Provider Class
- Guice - @Provides Annotation
- Guice - Constant Bindings
- Guice - @Named binding
- Guice - Binding Annotations
- Guice - Linked binding
- Guice - First Application
- Guice - Environment Setup
- Guice - Overview
- Guice - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Guice - Just-in-time Bindings
Google Guice - Just-In-Time Bindings
As bindings are defined in Binding Module, Guice uses them whenever it needs to inject dependencies. In case bindings are not present, it can attempt to create just-in-time bindings. Bindings present in binding module are called exppcit bindings and are of higher precedence whereas just-in-time bindings are called imppcit bindings. If both type of bindings are present, exppcit bindings are considered for mapping.
Following are the examples of three types of Just-in-time bindings.
Binding Type | Description |
---|---|
Non-private, No-argument constructors are epgible for just-in-time bindings. Another way is to annotate a constructor with @Inject annotation. | |
@ImplementedBy annotation tells the guice about the implementation class. No binding is required in Binding Module in such a case. | |
@ProvidedBy annotation tells the guice about the provider of implementation class. No binding is required in Binding Module in such a case. |