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 explicit bindings and are of higher precedence whereas just-in-time bindings are called implicit bindings. if both type of bindings are present, explicit bindings are considered for mapping.
following are the examples of three types of just-in-time bindings.
| binding type | description |
|---|---|
| injectable constructors | non-private, no-argument constructors are eligible for just-in-time bindings. another way is to annotate a constructor with @inject annotation. |
| @implementedby annotation | @implementedby annotation tells the guice about the implementation class. no binding is required in binding module in such a case. |
| @providedby annotation | @providedby annotation tells the guice about the provider of implementation class. no binding is required in binding module in such a case. |