In my service, I have a protected constructor with @Inject
and one of the parameters (provider) @Nullable
. Any ideas why I am getting
com.google.inject.CreationException: Guice creation errors: 1) No implementation for [[service]] was bound.
? Guice is 3.0pre1, @Nullable
is ours.
@Nullable
isn't the same as @Inject(optional=true)
... I think if you want to inject null
, you need to bind(Service.class).toProvider(Providers.<Service>of(null))
or to otherwise have some kind of provider bound that may return null
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With