当前位置: 首页>>代码示例>>Java>>正文


Java InjectionResolver类代码示例

本文整理汇总了Java中org.glassfish.hk2.api.InjectionResolver的典型用法代码示例。如果您正苦于以下问题:Java InjectionResolver类的具体用法?Java InjectionResolver怎么用?Java InjectionResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InjectionResolver类属于org.glassfish.hk2.api包,在下文中一共展示了InjectionResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {

	context.register(new AbstractBinder() {

		@Override
		protected void configure() {

			Injector injector = ClientGuiceBridgeFeature.getInjector(context.getConfiguration());
			ClientGuiceInjectInjector injectInjector = new ClientGuiceInjectInjector(injector);

			bind(injectInjector).to(new TypeLiteral<InjectionResolver<com.google.inject.Inject>>() {
			});
		}
	});

	return true;
}
 
开发者ID:bootique,项目名称:bootique-jersey-client,代码行数:19,代码来源:ClientGuiceBridgeFeature.java

示例2: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
    Configuration configuration = context.getConfiguration();
    if (!configuration.isRegistered(ConfigPropertyResolver.class)) {
        LOGGER.debug("Register ConfigPropertyFeature");
        context.register(ConfigPropertyResolver.class);
        context.register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(ConfigPropertyResolver.class)
                        .to(new TypeLiteral<InjectionResolver<ConfigProperty>>() {})
                        .in(Singleton.class);
            }
        });
    }
    return true;
}
 
开发者ID:protoxme,项目名称:protox-webapp-archetype,代码行数:18,代码来源:ConfigPropertyFeature.java

示例3: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {

	// for now only supporting Guice injection to resources

	// TODO: if we want to inject web environment objects back into Guice
	// services or to use JSR-330 annotations in Resources, we need
	// org.glassfish.hk2:guice-bridge integration

	// This feature can inject HK2 ServiceLocator in constructor, and then
	// we can bridge it both ways with Guice

	context.register(new AbstractBinder() {
		@Override
		protected void configure() {
			bind(GuiceInjectInjector.class).to(new TypeLiteral<InjectionResolver<com.google.inject.Inject>>() {
			}).in(Singleton.class);
		}
	});

	return true;
}
 
开发者ID:bootique,项目名称:bootique-jersey,代码行数:23,代码来源:GuiceBridgeFeature.java

示例4: run

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
    public void run(T configuration, Environment environment) {
        final HazelcastSessionConfig hazelcastSessionConfig = getHazelcastSessionConfig(configuration);

        final Class<? extends Factory<SessionsStore>> sessionsStoreFactoryClass = hazelcastSessionConfig.getSessionsStoreFactoryClass();
        environment.jersey().register(new AbstractBinder() {
            @Override
            protected void configure() {
                bindFactory(sessionsStoreFactoryClass).to(SessionsStore.class).in(Singleton.class);
                bind(hazelcastSessionConfig).to(HazelcastSessionConfig.class);
                bind(SessionObjectResolver.class)
                        .to(new TypeLiteral<InjectionResolver<Session>>() {
                        })
                        .in(Singleton.class);
            }
        });
//        environment.lifecycle().manage(new HazelcastInstanceManager(hazelcastInstance));
        environment.jersey().register(SetSessionIdResponseFilter.class);
    }
 
开发者ID:martindow,项目名称:dropwizard-hazelcast-session,代码行数:20,代码来源:HazelcastSessionBundle.java

示例5: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
    context.register(new AbstractBinder() {
        @Override
        public void configure() {
            bind(TokenAuthenticator.class)
                    .in(Singleton.class);
            bind(TokenFactory.class)
                    .in(Singleton.class);
            bind(TokenFactoryProvider.class)
                    .to(ValueFactoryProvider.class)
                    .in(Singleton.class);
            bind(TokenParamInjectionResolver.class)
                    .to(new TypeLiteral<InjectionResolver<RobeAuth>>() {
                    })
                    .in(Singleton.class);
        }
    });
    return true;
}
 
开发者ID:robeio,项目名称:robe,代码行数:21,代码来源:TokenFeature.java

示例6: bindSpecificComponent

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
/**
 * Binds jersey specific component (component implements jersey interface or extends class).
 * Specific binding is required for types directly supported by jersey (e.g. ExceptionMapper).
 * Such types must be bound to target interface directly, otherwise jersey would not be able to resolve them.
 * <p> If type is {@link HK2Managed}, binds directly.
 * Otherwise, use guice "bridge" factory to lazily bind type.</p>
 *
 * @param binder       hk binder
 * @param injector     guice injector
 * @param type         type which implements specific jersey interface or extends class
 * @param specificType specific jersey type (interface or abstract class)
 */
public static void bindSpecificComponent(final AbstractBinder binder, final Injector injector,
                                         final Class<?> type, final Class<?> specificType) {
    // resolve generics of specific type
    final GenericsContext context = GenericsResolver.resolve(type).type(specificType);
    final List<Type> genericTypes = context.genericTypes();
    final Type[] generics = genericTypes.toArray(new Type[genericTypes.size()]);
    final Type binding = generics.length > 0 ? new ParameterizedTypeImpl(specificType, generics)
            : specificType;
    if (isHK2Managed(type)) {
        binder.bind(type).to(binding).in(Singleton.class);
    } else {
        // hk cant find different things in different situations, so uniform registration is impossible
        if (InjectionResolver.class.equals(specificType)) {
            binder.bindFactory(new GuiceComponentFactory<>(injector, type))
                    .to(type).in(Singleton.class);
            binder.bind(type).to(binding).in(Singleton.class);
        } else {
            binder.bindFactory(new GuiceComponentFactory<>(injector, type))
                    .to(type).to(binding).in(Singleton.class);
        }
    }
}
 
开发者ID:xvik,项目名称:dropwizard-guicey,代码行数:35,代码来源:JerseyBinding.java

示例7: newActiveDescriptor

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
/**
 * @see #newThreeThirtyInjectionResolverDescriptor(ServiceLocator)
 * @see #newGuiceInjectionResolverDescriptor(ServiceLocator, ActiveDescriptor)
 */
private static <T extends Annotation> ActiveDescriptor<InjectionResolver<T>> newActiveDescriptor(ServiceLocator locator, 
    InjectionResolver<T> resolver, Set<Annotation> qualifiers, String name, Class<? extends T> clazz) {
  
  Set<Type> contracts = Collections.<Type>singleton(
      new ParameterizedTypeImpl(InjectionResolver.class, clazz));
  
  ActiveDescriptor<InjectionResolver<T>> descriptor =
    new ConstantActiveDescriptor<InjectionResolver<T>>(
      resolver, contracts, Singleton.class,
      name, qualifiers, DescriptorVisibility.NORMAL,
      0, (Boolean)null, (Boolean)null, (String)null, 
      locator.getLocatorId(), (Map<String, List<String>>)null);
  
  return descriptor;
}
 
开发者ID:Squarespace,项目名称:jersey2-guice,代码行数:20,代码来源:BindingUtils.java

示例8: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {
    bind(new RateLimiterFactoryProvider(requestRateLimiterFactory)).to(RateLimiterFactoryProvider.class);
    bind(RateLimitingFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(RateLimitingFactoryProvider.RateLimitingInjectionResolver.class)
            .to(new TypeLiteral<InjectionResolver<RateLimiting>>() {}).in(Singleton.class);
}
 
开发者ID:mokies,项目名称:ratelimitj,代码行数:8,代码来源:RateLimitBundle.java

示例9: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {
    bind(TestRateLimitingFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(TestRateLimitingFactoryProvider.TestRateLimitingInjectionResolver.class).to(
            new TypeLiteral<InjectionResolver<RateLimiting>>() {
            }
    ).in(Singleton.class);
}
 
开发者ID:mokies,项目名称:ratelimitj,代码行数:9,代码来源:RateLimit429EnforcerFilterTest.java

示例10: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {

    bind(JsonParamValueFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(JsonParamValueFactoryProvider.InjectionResolver.class).to(new TypeLiteral<InjectionResolver<JsonParam>>() {
    }).in(Singleton.class);

}
 
开发者ID:protoxme,项目名称:protox-webapp-archetype,代码行数:9,代码来源:JsonParamFeature.java

示例11: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {
    bind(dataSourceFactoryProvider);

    bindFactory(JDBIFactory.class)
            .to(DBI.class)
            .in(Singleton.class);

    bind(JDBIInjectionResolver.class)
            .to(new TypeLiteral<InjectionResolver<InjectDAO>>() {})
            .in(Singleton.class);
}
 
开发者ID:alex-shpak,项目名称:dropwizard-hk2bundle,代码行数:13,代码来源:JDBIBinder.java

示例12: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {
    bind(profile).to(ProfileFactoryBuilder.class);
    bind(optProfile).to(OptionalProfileFactoryBuilder.class);
    bind(manager).to(ProfileManagerFactoryBuilder.class);

    bind(Pac4JProfileValueFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);

    bind(ProfileInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Pac4JProfile>>() {
    }).in(Singleton.class);
    bind(ProfileManagerInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Pac4JProfileManager>>() {
    }).in(Singleton.class);
}
 
开发者ID:pac4j,项目名称:jax-rs-pac4j,代码行数:14,代码来源:Pac4JValueFactoryProvider.java

示例13: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {
	bind(CustomAnnotationProvider.class)
			.to(ValueFactoryProvider.class)
			.in(Singleton.class);

	bind(CustomAnnotationResolver.class)
			.to(new TypeLiteral<InjectionResolver<CustomAnnotation>>() {
			})
			.in(Singleton.class);
}
 
开发者ID:Maddoc42,项目名称:JaxRs2Retrofit,代码行数:12,代码来源:CustomAnnotationTest.java

示例14: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override protected void configure() {
  bind(clientAuthFactory);
  bind(automationClientAuthFactory);
  bind(userAuthFactory);
  bind(AuthValueFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
  bind(AuthInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Auth>>() {}).in(Singleton.class);
}
 
开发者ID:square,项目名称:keywhiz,代码行数:8,代码来源:AuthResolver.java

示例15: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {
    bind(new ConfigurationFactoryInfo(configuration, dataSource, multiTenantConnectionProvider))
            .to(ConfigurationFactoryInfo.class);
    bind(ConfigurationFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(ConfigurationInjectionResolver.class).to(new TypeLiteral<InjectionResolver<JooqConfiguration>>() {
    }).in(Singleton.class);
}
 
开发者ID:tbugrara,项目名称:dropwizard-jooq,代码行数:9,代码来源:ConfigurationFactoryProvider.java


注:本文中的org.glassfish.hk2.api.InjectionResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。