• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InjectionResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: configure

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

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

  bind(UserAuthHeaderParamResolver.class)
      .to(new TypeLiteral<InjectionResolver<AuthParam>>() {
      })
      .in(Singleton.class);

}
 
开发者ID:zourzouvillys,项目名称:graphql,代码行数:15,代码来源:AuthContainerRequestFilter.java


示例17: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {
    if (nonNull(properties)) {
        Map<String, String> propertyMap = properties.stringPropertyNames().stream()
            .collect(toMap(Function.identity(), properties::getProperty));

        Map<Type, Function<String, ?>> parsers = new HashMap<>();
        parsers.put(Integer.class, new IntegerPropertyParser());
        parsers.put(Long.class, new LongPropertyParser());
        parsers.put(String.class, Function.identity());

        bind(new PropertyResolver(propertyMap, parsers))
            .to(new TypeLiteral<InjectionResolver<Property>>() {});
    }
}
 
开发者ID:petrbouda,项目名称:joyrest,代码行数:16,代码来源:ApplicationBinder.java


示例18: configure

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

    bind(PropertiesValueFactoryProvider.PropertyInjectionResolver.class)
            .to(new TypeLiteral<InjectionResolver<Prop>>() {
            }).in(Singleton.class);

    bind(PropertiesValueFactoryProvider.class)
            .to(ValueFactoryProvider.class)
            .in(Singleton.class);
}
 
开发者ID:psamsotha,项目名称:jersey-properties,代码行数:13,代码来源:JerseyPropertiesFeature.java


示例19: scanAndAdd

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
public void scanAndAdd(Environment environment, Injector injector, Reflections reflections) {
    Set<Class<? extends InjectionResolver>> resolvers = reflections.getSubTypesOf(InjectionResolver.class);
    for (Class<? extends InjectionResolver> resolver : resolvers) {
        //TODO: Check if it is valid usage.
        environment.jersey().register(resolver);
        LOGGER.info("Added InjectableResolver: " + resolver);
    }
}
 
开发者ID:robeio,项目名称:robe,代码行数:10,代码来源:InjectableProviderScanner.java


示例20: configure

import org.glassfish.hk2.api.InjectionResolver; //导入依赖的package包/类
@Override
protected void configure() {
    bind(new PrincipalClassProvider<>(principalClass)).to(PrincipalClassProvider.class);
    bind(TokenFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(TokenParamInjectionResolver.class).to(new TypeLiteral<InjectionResolver<RobeAuth>>() {
    }).in(Singleton.class);
}
 
开发者ID:robeio,项目名称:robe,代码行数:8,代码来源:TokenFactoryProvider.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpSessionRequiredException类代码示例发布时间:2022-05-21
下一篇:
Java IDeviceService类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap