Wait… didn't we add requireAtInjectOnConstructors() as a halfway
between full JIT and requireExplicitBindings()?
I see it here:
http://google-guice.googlecode.com/git/core/src/com/google/inject/Binder.java
If you're building your own snapshot of Guice, then you should have
access to it. If not, it should be out shortly when we roll a release
candidate. But please do try it out by rolling a local copy of guice
from head.
c.
On 23 Jul 2013, at 14:42, Stuart McCulloch wrote:
On 23 Jul 2013, at 22:28, Eric Tschetter wrote:
Thanks for the quick response!
Binder.requireExplicitBindings() is causing it to fail on binding
something that has an @Inject annotation on it. I was hoping to just
disable the injection of things without the annotation, but I'm
guessing that's not possible?
Yes with requireExplicitBindings you will have to be more verbose,
even down to binding the actual implementation classes as follows:
bind( MyComponentImpl.class );
@Inject just declares a dependency on something, rather than being a
binding that can provide something, so this is working as designed
If that's the case, that's fine, I can deal with being even more
explicit and requiring a bind for everything.
On Tue, Jul 23, 2013 at 2:20 PM, Stuart McCulloch <[email protected]>
wrote:
On 23 Jul 2013, at 22:13, Eric Tschetter wrote:
Hello everyone.
I'm looking for a way to disable JIT bindings in Guice. Google
found
http://code.google.com/p/google-guice/issues/detail?id=342
For me, but it looks like r1141 referenced in there is a broken link
now (probably switched source control systems and the links aren't
updated? I'm not sure how to search for the old commit...). I also
don't know that an InjectorBuilder is (can't find the class in the
current code, so am guessing it's something that existed in 2009 and
doesn't anymore).
I'm guessing this functionality was maintained, but am wondering how
to enable it. Basically I want to disable any injection that is not
either (a) bound in a module or (b)
of an object with an @Inject binding.
The equivalent git hash is
http://code.google.com/p/google-guice/source/detail?r=888a264bdee08c82cccd9dcc94a8a4ac98912bad
Since then the requireExplicitBindings option was moved to the Binder
API:
http://google-guice.googlecode.com/git/javadoc/com/google/inject/Binder.html#requireExplicitBindings()
--Eric
--
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 http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.
Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency
Injection
email: [email protected] :::: mobile: +1 (646) 807-9839
--
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 http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.