本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}