I think there might be some performance concerns, since the cost of
creating a child injector scales wither number of bindings in the child
injector. Whereas using request scope you just pay the overhead (of the
threadlocal interactions) for the bindings that you actually use in a
request. For large applications there might be a large difference between
these two numbers.
On Thu, Dec 22, 2016 at 3:25 PM Bob Lee <[email protected]> wrote:

> On Tue, Dec 20, 2016 at 1:07 PM, Greg Methvin <[email protected]>
> wrote:
>
> So would you say I shouldn't worry about the cost of creating child
> injectors on every request? I sort of like this approach. Having to
> transfer state between thread locals seems error-prone.
>
>
> Correct. Child injectors were designed with this very use case in mind. Of
> course, you'll want to avoid slow operations in your request-scoped
> modules. Child injectors are less error prone than Scopes because they make
> it impossible for an object in a larger scope to directly reference an
> object in a smaller scope (for example, a global singleton can't be
> injected with a request-scoped object).
>
> Bob
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/google-guice.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-guice/CAGmsiP4Stf2KZtE%3De85GCzUVNuNxj8DSg-2y5Kg%2BTHfKmJaYzQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-guice/CAGmsiP4Stf2KZtE%3De85GCzUVNuNxj8DSg-2y5Kg%2BTHfKmJaYzQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/CAO9V1MKR%2BYwbyQXbMjAxrv3nKkfnvzxMkRMx7EMkHaWKw71y6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to