-
Interfaces Interface Description com.google.inject.throwingproviders.ThrowingProvider useCheckedProvider
instead.
-
Classes Class Description com.google.inject.assistedinject.FactoryProvider useFactoryModuleBuilder
instead.com.google.inject.multibindings.MultibindingsScanner This functionality is installed by default. All references to this can be safely removed. This class will be removed in Guice 4.4com.google.inject.spi.DependencyAndSource The only use of this object is forProvisionListener.ProvisionInvocation.getDependencyChain()
which is also deprecated. This object will also be removed in Guice 4.4.
-
Methods Method Description com.google.inject.multibindings.MultibindingsScanner.asModule() This functionality is now installed by default. All references/installations can be eliminated.com.google.inject.multibindings.MultibindingsScanner.scanner() This method returns an empty scanner since the preexisting functionality is installed by default.com.google.inject.servlet.ServletScopes.continueRequest(Callable<T>, Map<Key<?>, Object>) You probably want to usetransferRequest
insteadcom.google.inject.spi.ProviderInstanceBinding.getProviderInstance() UseProviderInstanceBinding.getUserSuppliedProvider()
instead.com.google.inject.spi.ProvisionListener.ProvisionInvocation.getDependencyChain() This method is planned for removal in Guice 4.4. Some use cases can be replaced by inferring the current chain via ThreadLocals in the listener, other use cases can use the static dependency graph. For example,bindListener(Matchers.any(), new MyListener()); ... private static final class MyListener implements ProvisionListener { private final ThreadLocal<ArrayDeque<Binding<?>>> bindingStack = new ThreadLocal<ArrayDeque<Binding<?>>>() { {@literal @}Override protected ArrayDeque<Binding<?>> initialValue() { return new ArrayDeque<>(); } }; {@literal @}Override public <T> void onProvision(ProvisionInvocation<T> invocation) { bindingStack.get().push(invocation.getBinding()); try { invocation.provision(); } finally { bindingStack.get().pop(); } // Inspect the binding stack... } }
In this example the bindingStack thread local will contain a data structure that is very similar to the data returned by this list. The main differences are that linked keys are not in the stack, but such edges do exist in the static dependency graph (inspectable via
HasDependencies.getDependencies()
), so you could infer some of the missing edges..com.google.inject.throwingproviders.ThrowingProviderBinder.bind(Class<P>, Type) com.google.inject.util.Modules.combine(Module) there's no need to "combine" one module; just install it directly.com.google.inject.util.Modules.OverriddenModuleBuilder.with() there's no reason to use.with()
without any arguments.com.google.inject.util.Modules.override() there's no reason to useModules.override()
without any arguments.