Under latest guice 4.0-SNAPSHOT: Overriding @Provides method not allowed
Closed this issue · 3 comments
It appears a policy/validation change introduced in recent guice development (required, btw, for java8 support) is incompatible with an implementation detail in dropwizard-guice.
With the following in my pom.xml:
<properties>
<java.version>1.8</java.version>
<guice.version>4.0-SNAPSHOT</guice.version>
<dropwizard.version>0.7.0</dropwizard.version>
...
<repositories>
<repository>
<id>google-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
...
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>
<dependency>
<groupId>com.hubspot.dropwizard</groupId>
<artifactId>dropwizard-guice</artifactId>
<version>${dropwizard.version}</version>
</dependency>
... server fails to start with the following error:
ERROR [2014-08-12 14:54:10,565] com.hubspot.dropwizard.guice.GuiceBundle: Exception occurred when creating Guice Injector - exiting
! com.google.inject.CreationException: Unable to create injector, see the following errors:
!
! 1) Overriding @provides methods is not allowed.
! @provides method: com.sun.jersey.guice.JerseyServletModule.webApp()
! overridden by: com.hubspot.dropwizard.guice.JerseyContainerModule.webApp()
! at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:126)
I just released version 0.7.1 which should fix this issue, can you give it a try
It works here! 👍 Thanks @HiJon89
👍