本文整理汇总了Java中org.glassfish.hk2.utilities.binding.AbstractBinder类的典型用法代码示例。如果您正苦于以下问题:Java AbstractBinder类的具体用法?Java AbstractBinder怎么用?Java AbstractBinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractBinder类属于org.glassfish.hk2.utilities.binding包,在下文中一共展示了AbstractBinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的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;
}
示例2: JerseyResourceConfig
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
public JerseyResourceConfig() {
register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(ContextFactory.class)
.to(ServiceRequestContext.class).proxy(true)
.proxyForSameScope(false).in(RequestScoped.class);
}
});
register(ActivityFilter.class);
register(AuthenticationFilter.class);
register(AuthorizationFilter.class);
register(MethodFilter.class);
register(VersionFilter.class);
register(Health.class);
register(Frontend.class);
register(VersionedMessageProvider.class);
register(ExceptionProvider.class);
}
示例3: configure
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的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;
}
示例4: setUp
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator();
ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
@Override
protected void configure() {
bind(SecurityService.class).to(SecurityService.class);
bind(accountDao).to(AccountDao.class);
bind(passwordDao).to(AccountPasswordDao.class);
bind(userProvider).to(UserProvider.class);
bind(event).to(new TypeLiteral<Event<SignedInEvent>>() {
});
}
});
locator.inject(this);
}
示例5: XbddApplication
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
public XbddApplication() {
packages(getClass().getPackage().getName());
// MVC feature
property(JspMvcFeature.TEMPLATE_BASE_PATH, "/WEB-INF/jsp");
register(JspMvcFeature.class);
register(MultiPartFeature.class);
// Logging.
// register(LoggingFilter.class);
property(ServerProperties.TRACING, TracingConfig.ON_DEMAND.name());
register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(ServletContextMongoClientFactory.class).to(MongoDBAccessor.class).in(Singleton.class);
}
});
}
示例6: JerseyApplication
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
public JerseyApplication() {
property(CrnkProperties.RESOURCE_SEARCH_PACKAGE, "io.crnk.example.jersey.domain");
property(CrnkProperties.RESOURCE_DEFAULT_DOMAIN, APPLICATION_URL);
register(CrnkDynamicFeature.class);
register(new AbstractBinder() {
@Override
public void configure() {
bindFactory(ObjectMapperFactory.class).to(ObjectMapper.class).in(Singleton.class);
bindService(TaskRepository.class);
bindService(ProjectRepository.class);
bindService(TaskToProjectRepository.class);
}
private void bindService(Class<?> serviceType) {
bind(serviceType).to(serviceType).proxy(true).in(RequestScoped.class);
}
});
}
示例7: run
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Override
public void run(final CONFIG configuration,
final Environment environment) {
environment.jersey().register(auditedQueryResourceClass);
environment.jersey().register(auditedDocRefResourceClass);
environment.jersey().register(new AbstractBinder() {
@Override
protected void configure() {
bind(QueryEventLoggingService.class).to(EventLoggingService.class);
bind(queryServiceClass).to(QueryService.class);
bind(docRefServiceClass).to(new ParameterizedTypeImpl(DocRefService.class, docRefEntityClass));
bind(AuthorisationServiceImpl.class).to(AuthorisationService.class);
bind(configuration.getAuthorisationServiceConfig()).to(AuthorisationServiceConfig.class);
bind(configuration.getTokenConfig()).to(TokenConfig.class);
}
});
}
示例8: run
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Override
public void run(final CONFIG configuration,
final Environment environment) throws Exception {
environment.jersey().register(auditedQueryResourceClass);
environment.jersey().register(auditedDocRefResourceClass);
environment.jersey().register(new AbstractBinder() {
@Override
protected void configure() {
bind(QueryEventLoggingService.class).to(EventLoggingService.class);
final QueryService queryService =
new QueryServiceCriteriaImpl<>(AuditedCriteriaQueryBundle.this.queryableEntityClass, hibernateBundle.getSessionFactory());
bind(queryService).to(QueryService.class);
bind(hibernateBundle.getSessionFactory()).to(SessionFactory.class);
bind(docRefServiceClass).to(new ParameterizedTypeImpl(DocRefService.class, docRefClass));
bind(AuthorisationServiceImpl.class).to(AuthorisationService.class);
bind(configuration.getAuthorisationServiceConfig()).to(AuthorisationServiceConfig.class);
bind(configuration.getTokenConfig()).to(TokenConfig.class);
}
});
}
示例9: init
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) throws Exception
{
if(event.getSide().isServer())
modpack = new Modpack(logger, solderConfig, gson);
if(event.getSide().isServer() && solderConfig.isEnabled()) {
logger.info("Loading mod MinecraftSolder");
ResourceConfig config = new ResourceConfig()
.packages("it.admiral0")
.register(new AbstractBinder() {
@Override
protected void configure() {
bind(solderConfig);
bind(Loader.instance());
bind(modpack);
bind(gson);
}
});
HttpServer server = GrizzlyHttpServerFactory.createHttpServer(solderConfig.getBaseUri(), config);
server.getServerConfiguration().addHttpHandler(
new StaticHttpHandler(modpack.getSolderCache().toAbsolutePath().toString()), "/download"
);
server.start();
logger.info("Server running on " + solderConfig.getBaseUri().toString());
}else{
logger.info("Mod is disabled.");
}
}
示例10: backstopperOnlyExceptionMapperFactory_removes_all_exception_mappers_except_Jersey2ApiExceptionHandler
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Test
public void backstopperOnlyExceptionMapperFactory_removes_all_exception_mappers_except_Jersey2ApiExceptionHandler()
throws NoSuchFieldException, IllegalAccessException {
// given
AbstractBinder lotsOfExceptionMappersBinder = new AbstractBinder() {
@Override
protected void configure() {
bind(JsonMappingExceptionMapper.class).to(ExceptionMapper.class).in(Singleton.class);
bind(JsonParseExceptionMapper.class).to(ExceptionMapper.class).in(Singleton.class);
bind(generateJerseyApiExceptionHandler(projectApiErrors, utils)).to(ExceptionMapper.class);
}
};
ServiceLocator locator = ServiceLocatorUtilities.bind(lotsOfExceptionMappersBinder);
// when
BackstopperOnlyExceptionMapperFactory overrideExceptionMapper = new BackstopperOnlyExceptionMapperFactory(locator);
// then
Set<Object> emTypesLeft = overrideExceptionMapper.getFieldObj(
ExceptionMapperFactory.class, overrideExceptionMapper, "exceptionMapperTypes"
);
assertThat(emTypesLeft).hasSize(1);
ServiceHandle serviceHandle = overrideExceptionMapper.getFieldObj(emTypesLeft.iterator().next(), "mapper");
assertThat(serviceHandle.getService()).isInstanceOf(Jersey2ApiExceptionHandler.class);
}
示例11: JerseyApplication
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
public JerseyApplication() {
property(KatharsisProperties.RESOURCE_SEARCH_PACKAGE, "io.katharsis.example.jersey.domain");
property(KatharsisProperties.RESOURCE_DEFAULT_DOMAIN, APPLICATION_URL);
register(KatharsisDynamicFeature.class);
register(new AbstractBinder() {
@Override
public void configure() {
bindFactory(ObjectMapperFactory.class).to(ObjectMapper.class).in(Singleton.class);
bindService(TaskRepository.class);
bindService(ProjectRepository.class);
bindService(TaskToProjectRepository.class);
}
private void bindService(Class<?> serviceType) {
bind(serviceType).to(serviceType).proxy(true).in(RequestScoped.class);
}
});
}
示例12: Main
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
private Main() {
packages("us.askplatyp.kb.lucene.http");
register(JacksonFeature.class);
register(EntityFilteringFeature.class);
register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(WikidataLuceneIndexFactory.class).to(LuceneIndex.class);
}
});
register(CORSFilter.class);
register(ApiListingResource.class);
register(SwaggerSerializers.class);
EncodingFilter.enableFor(this, GZipEncoder.class);
EncodingFilter.enableFor(this, DeflateEncoder.class);
configureSwagger();
}
示例13: configure
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
@Override
protected Application configure() {
ResourceConfig resourceConfig = new ResourceConfig()
.register(LocatorFeature.class)
.register(JacksonFeature.class)
.register(RxJerseyClientFeature.class)
.register(ServerResource.class)
.register(new AbstractBinder() {
@Override
protected void configure() {
bind(RxJerseyTest.this).to(JerseyTest.class);
}
});
configure(resourceConfig);
return resourceConfig;
}
示例14: DefaultApplication
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
/**
* Default constructor.
*/
public DefaultApplication() {
// Parsec default bindings and registers
super();
register(new AbstractBinder() {
@Override
protected void configure() {
// Add additional binding here
// bind(<implementation>.class).to(<interface>.class)
}
});
// Add additional register here
// register(<resource>.class)
}
示例15: initializeServer
import org.glassfish.hk2.utilities.binding.AbstractBinder; //导入依赖的package包/类
private void initializeServer() {
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.packages(GridServices.class.getPackage().getName());
resourceConfig.register(JacksonJaxbJsonProvider.class);
final Grid grid = this;
resourceConfig.register(new AbstractBinder() {
@Override
protected void configure() {
bind(grid).to(Grid.class);
bind(fileManager).to(FileProvider.class);
}
});
ServletContainer servletContainer = new ServletContainer(resourceConfig);
ServletHolder sh = new ServletHolder(servletContainer);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
context.addServlet(sh, "/*");
server = new Server(port);
ContextHandlerCollection contexts = new ContextHandlerCollection();
contexts.setHandlers(new Handler[] { context});
server.setHandler(contexts);
}