You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Need to reset AssistedInject factory elements when using BeanScanning.CACHE (Bugzilla Bug 456633) #23
Date: 2015-01-04 16:55:02 -0500
From: Stuart McCulloch <mcculls@gmail.com>
When running multiple tests with BeanScanning.CACHE (which caches and re-uses elements to save setup time) and AssistedInject factories, the following exception can occur:
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) Factories.create() factories may only be used in one Injector!
at com.google.inject.assistedinject.FactoryProvider2.class(FactoryProvider2.java:86)
at com.google.inject.assistedinject.FactoryProvider2.initialize(FactoryProvider2.java:577)
at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule -> org.eclipse.sisu.space.SpaceModule$1 -> org.sonatype.nexus.repository.internal.RepositoryModule -> com.google.inject.assistedinject.FactoryModuleBuilder$1)
1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:448)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:176)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
at com.google.inject.Guice.createInjector(Guice.java:96)
at com.google.inject.Guice.createInjector(Guice.java:73)
at com.google.inject.Guice.createInjector(Guice.java:62)
The recommended workaround is to use BeanScanning.INDEX which is almost as fast as the CACHE setting, but doesn't suffer from cache-related issues like the above exception.
To support AssistedInject properly with BeanScanning.CACHE we'll need to reset the affected factory elements, just like we did with the private lookup elements in bug #429366.
Activity
Add temporal converter to support Java 8 time/date classes (#46)