Skip to content

Duplicate Modules Cause Injector Creation Failure #65

@cielowu

Description

@cielowu

Hi,

So I'm bumping our system to Dropwizard 2.x, dropwizard-guice causes an issue because the (jersey2-guice)[https://github.com/HubSpot/dropwizard-guice] still uses prior Jersey 2.6 version.

So I'm trying to migrate from dropwizard-guice to this to give it a try. However, duplicate modules cause the creation failure of the Injector.

After digging it a little bit, this is because now the default InjectorFactory implementation uses Modules.combine to combine all the modules. This makes the uniqueness check inside LifecycleInjectorBuilderImpl.java that we use essentially become ineffective.

public interface InjectorFactory {
  Injector create(Stage stage, Module module);

  default Injector create(Stage stage, Iterable<? extends Module> modules) {
    return create(stage, Modules.combine(modules));
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions