When to use Guice's Just-in-time Bindings?

I read Guice's documentation on its Just-in-time Bindings and it says nothing about when to use it. Also on on their main GitHub page they say:

Guice is not a kitchen sink. We justify each feature with at least three use cases.

I can't find a section where they would show me such use cases for their Just-in-time bindings.

Thank you.

P.S. I am sorry if I have made any mistakes.

Upvotes: 0

Views: 360

Answers (1)

Matthew Pope
Matthew Pope

Reputation: 7679

Maybe Google Guice didn’t provide use cases because this is the core feature of Guice. It seems to me that everything else is a feature on top of JIT bindings or a feature that fills a gap where you can’t use JIT bindings. That being said, I’m not on the Guice team, so I can’t really do anything more than speculate about what they were thinking.

Anyway, here are some use cases I came up with

  1. You don’t have to write a lot of trivial bindings.
  2. You can use Guice without writing modules.
  3. You might need Guice to instantiate something from a library that was not built with Guice bindings or annotations.

Upvotes: 1

Related Questions