Hi all,
We've had a long standing grudge against Guice (which we love in all
other respects!): the inability to have user-defined just-in-time
bindings.
Over the course of the long weekend, I've implemented this feature and
would love some feedback. Check it out on
http://eng.kaching.com/2010/05/just-in-time-providers-for-guice.html.
I would specifically appreciate feedback from the Guice team on the
process to integrate this patch into trunk.
On a more tactical note, I
was unsure about which injection points to use, see the ??? comment in
the method
http://github.com/pascallouisperez/guice-jit-providers/blob/master/src/com/google/inject/internal/InjectorImpl.java#LID830.
Best,
PL
--
You received this message because you are subscribed to the Google Groups "google-guice-dev" group.
To post to this group, send email to google-g...@googlegroups.com.
To unsubscribe from this group, send email to google-guice-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice-dev?hl=en.
One of my deepest concerns with JIT bindings is the wonderful way in
which it moves your wiring errors JIT as well, which makes debugging
more difficult, and can result in learning about such errors in
production AFTER deployment, depending on the particular layout and
timings of your injections. So, powerful, but dangerous and there
might be more suitable ways to accomplish what you want.
What would you need just-in-time bindings for?
Christian.
> Best,
> PL
>
> --
> You received this message because you are subscribed to the Google
> Groups "google-guice-dev" group.
> To post to this group, send email to google-guice-
> d...@googlegroups.com.
Can you talk through the use-cases for user-defined just-in-time bindings? As far as I can see, using providers to obtain just-in-time binding behaviour is highly dangerous. i can imagine some leegitimate use-cases for it, but most of the time when people talk about such things (often injecting a Provider as a workaround) they really are trying to workaround Guice's lack of lifecycle support.
One of my deepest concerns with JIT bindings is the wonderful way in which it moves your wiring errors JIT as well, which makes debugging more difficult, and can result in learning about such errors in production AFTER deployment, depending on the particular layout and timings of your injections. So, powerful, but dangerous and there might be more suitable ways to accomplish what you want.
What would you need just-in-time bindings for?
Christian.
On May 31, 2010, at 11:12 PM, Pascal-Louis wrote:
Hi all,
We've had a long standing grudge against Guice (which we love in all
other respects!): the inability to have user-defined just-in-time
bindings.
Over the course of the long weekend, I've implemented this feature and
would love some feedback. Check it out on
http://eng.kaching.com/2010/05/just-in-time-providers-for-guice.html.
I would specifically appreciate feedback from the Guice team on the
process to integrate this patch into trunk. On a more tactical note, I
was unsure about which injection points to use, see the ??? comment in
the method
http://github.com/pascallouisperez/guice-jit-providers/blob/master/src/com/google/inject/internal/InjectorImpl.java#LID830.
Best,
PL
--
You received this message because you are subscribed to the Google Groups "google-guice-dev" group.
To post to this group, send email to google-g...@googlegroups.com.
To unsubscribe from this group, send email to google-guice-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice-dev?hl=en.
--
You received this message because you are subscribed to the Google Groups "google-guice-dev" group.
To post to this group, send email to google-g...@googlegroups.com.
Jesse,
In practice, the dozen or so bindings are more like 50 or 100; and
very fragile. Add one use of a proxy, and now you need to add this
binding to all the entry points. (You might wonder why we don't have a
common module with all of those. Many are singleton scoped and so we
do not want to create them in systems that do not need them.)
Since this has bitten us a lot in the past, we wanted to spend the
time to replace this with a generic and robust solution.
I'll do the improvements and report back. I'll also address Stuart's
comments about whitespace edits and such to have a clean patch.
PL
On Jun 2, 5:35 pm, "je...@swank.ca" <limpbiz...@gmail.com> wrote:
> On Jun 2, 7:41 am, Pascal-Louis <pascallouispe...@gmail.com> wrote:
>
> > Would that address your concerns?
>
> It would, but it still doesn't quite pay for its complexity.
> Autobinders would let you replace something structurally simple but
> verbose (a dozen or so repetitive bind() statements) with something
> structurally complex but compact (some reflection to implement
> JitProvider).
--
You received this message because you are subscribed to the Google Groups "google-guice-dev" group.
To post to this group, send email to google-g...@googlegroups.com.
To unsubscribe from this group, send email to google-guice-d...@googlegroups.com.