我將爲Java 7編寫的應用程序升級到版本8.它使用Guice將配置值注入到對象的構造函數中。Guice CreationException由於缺少java.util.Optional的實現
java.lang.RuntimeException: com.google.inject.CreationException: Guice creation errors:
1) No implementation for java.util.Optional<java.lang.Boolean> annotated with @Config(value=AsyncHttpClientConfigProvider.allowPoolingConnection) was bound.
while locating java.util.Optional<java.lang.Boolean> annotated with @Config(value=AsyncHttpClientConfigProvider.allowPoolingConnection)
for field at AsyncHttpClientConfigProvider.allowPoolingConnection(AsyncHttpClientConfigProvider.java:212)
at Module.configure(Module.java:24)
...
13 errors
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)
at org.jukito.JukitoRunner.ensureInjector(JukitoRunner.java:105)
at org.jukito.JukitoRunner.computeTestMethods(JukitoRunner.java:233)
... 19 more
什麼可能我會丟失,將導致此錯誤:但是,加大了Java版本後,我現在運行單元測試時得到這個神祕的錯誤?