Search in sources :

Example 1 with InjectorProvider

use of ru.vyarus.dropwizard.guice.injector.lookup.InjectorProvider in project dropwizard-guicey by xvik.

the class Jersey2Module method configure.

@Override
protected void configure() {
    checkHkFirstMode();
    final EnumSet<DispatcherType> types = context.option(GuiceFilterRegistration);
    final boolean guiceServletSupport = !types.isEmpty();
    // injector not available at this point, so using provider
    final InjectorProvider provider = new InjectorProvider(application);
    install(new GuiceBindingsModule(provider, guiceServletSupport));
    final GuiceFeature component = new GuiceFeature(provider, context.stat(), context.lifecycle(), context.option(UseHkBridge));
    bind(InjectionManager.class).toProvider(component);
    // avoid registration when called within guice report
    if (currentStage() != Stage.TOOL) {
        environment.jersey().register(component);
    }
    if (guiceServletSupport) {
        install(new GuiceWebModule(environment, types));
    }
}
Also used : GuiceBindingsModule(ru.vyarus.dropwizard.guice.module.jersey.hk2.GuiceBindingsModule) DispatcherType(javax.servlet.DispatcherType) InjectorProvider(ru.vyarus.dropwizard.guice.injector.lookup.InjectorProvider) InjectionManager(org.glassfish.jersey.internal.inject.InjectionManager)

Aggregations

DispatcherType (javax.servlet.DispatcherType)1 InjectionManager (org.glassfish.jersey.internal.inject.InjectionManager)1 InjectorProvider (ru.vyarus.dropwizard.guice.injector.lookup.InjectorProvider)1 GuiceBindingsModule (ru.vyarus.dropwizard.guice.module.jersey.hk2.GuiceBindingsModule)1