本文整理汇总了Java中org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge.bridgeGuiceInjector方法的典型用法代码示例。如果您正苦于以下问题:Java GuiceIntoHK2Bridge.bridgeGuiceInjector方法的具体用法?Java GuiceIntoHK2Bridge.bridgeGuiceInjector怎么用?Java GuiceIntoHK2Bridge.bridgeGuiceInjector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge
的用法示例。
在下文中一共展示了GuiceIntoHK2Bridge.bridgeGuiceInjector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JerseyApplication
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public JerseyApplication(ServiceLocator serviceLocator) {
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(AppLoader.injector);
String disableMoxy = PropertiesHelper.getPropertyNameForRuntime(
CommonProperties.MOXY_JSON_FEATURE_DISABLE,
getConfiguration().getRuntimeType());
property(disableMoxy, true);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
// add the default Jackson exception mappers
register(JsonParseExceptionMapper.class);
register(JsonMappingExceptionMapper.class);
register(JacksonJsonProvider.class, MessageBodyReader.class, MessageBodyWriter.class);
packages(JerseyApplication.class.getPackage().getName());
for (JerseyConfigurator configurator: AppLoader.getExtensions(JerseyConfigurator.class)) {
configurator.configure(this);
}
}
示例2: configure
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
InjectionManager injectionManager = InjectionManagerProvider.getInjectionManager(context);
ServiceLocator locator;
if (injectionManager instanceof ImmediateHk2InjectionManager) {
locator = ((ImmediateHk2InjectionManager) injectionManager).getServiceLocator();
} else if (injectionManager instanceof DelayedHk2InjectionManager) {
locator = ((DelayedHk2InjectionManager) injectionManager).getServiceLocator();
} else {
throw new IllegalStateException("expected an hk2 injection manager");
}
GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator);
// register all your modules, here
Injector injector = Guice.createInjector(new GreetingModule());
GuiceIntoHK2Bridge guiceBridge = locator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
return true;
}
示例3: Application
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public Application(ServiceLocator serviceLocator) {
//Since Jersey doesn't support Guice, setup a bridge so that Guice will work
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(Main.injector);
//Gets Jackson all squared away with Jersey
register(Jackson1Feature.class);
register(DefaultObjectMapperProvider.class);
//Register apis and other Jersey things here
register(TestApi.class);
register(TestExceptionMapper.class);
}
示例4: MyApplication
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public MyApplication(ServiceLocator serviceLocator) {
packages(Resource.class.getPackage().getName()); // todo: try class
// todo: test!
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(Service.class);
}
});
// todo: auth intercept (will not work with Guice - make dual mapping or use jersey interceptors or try jersey2-guice)
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
}
示例5: DashAppConfig
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public DashAppConfig(ServiceLocator serviceLocator) {
logger.info("Registering packages on {}", DashContants.DASH_REST_PACKAGE);
// Register package for rest endpoints and fasterxml for JSON support
packages(DashContants.DASH_REST_PACKAGE, DashContants.FASTERXML_PACKAGE);
logger.info("Building Injectors");
Injector injector = Guice.createInjector(
new ConfigurationInjection(),
new DashGuiceH4ServletModule(),
new DashH4ServiceInjection(),
//new DashGuiceH4Module(),
new JSONInjection()
);
// PersistentInit persistenceInit = new PersistentInit();
PersistenceInit persistenceInit = new PersistenceInit();
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
}
示例6: ApiConfig
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public ApiConfig(ServiceLocator serviceLocator) {
register(JacksonFeature.class);
register(ValidationFeature.class);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true");
register(AuthenticationRequestFilter.class);
register(AdminNecessaryRequestFilter.class);
register(RepositoryControllRequestFilter.class);
register(HttpCacheControlFilter.class);
register(ApiForbiddenExceptionMapper.class);
register(ApiNotFoundExceptionMapper.class);
register(ApiLoginRequiredExceptionMapper.class);
register(AjaxValidationErrorExceptionMapper.class);
register(PostErrorResponseFilter.class);
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(GuiceListener.get());
packages(false, this.getClass().getPackage() + ".rs");
}
示例7: AppConfig
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public AppConfig(ServiceLocator serviceLocator) {
register(FreemarkerMvcFeature.class);
property(FreemarkerMvcFeature.TEMPLATES_BASE_PATH, "/WEB-INF/templates");
property(FreemarkerMvcFeature.TEMPLATE_OBJECT_FACTORY, FlexibleConfiguration.class);
register(AttachContextInterceptor.class);
register(ValidationFeature.class);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, "true");
register(AuthenticationRequestFilter.class);
register(AdminNecessaryRequestFilter.class);
register(RepositoryControllRequestFilter.class);
register(HtmlLoginRequiredExceptionMapper.class);
register(HttpCacheControlFilter.class);
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(GuiceListener.get());
packages(false, this.getClass().getPackage() + ".html");
}
示例8: WebApp
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public WebApp(Injector injector, ServiceLocator serviceLocator) {
log.info("Setting up Web Application");
register(SseFeature.class);
register(MultiPartFeature.class);
register(ExposrExceptionMapper.class);
// Resources.
register(BuildResource.class);
register(ExposrResource.class);
register(ProjectResource.class);
register(SyncResource.class);
register(TaskResource.class);
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
final GuiceIntoHK2Bridge bridge = serviceLocator
.getService(GuiceIntoHK2Bridge.class);
bridge.bridgeGuiceInjector(injector);
}
示例9: onStartup
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Override
public void onStartup(Container container) {
logger.trace("Setting up Guice bridge {}", container);
ServiceLocator locator = container.getApplicationHandler()
.getServiceLocator();
GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator);
GuiceIntoHK2Bridge guiceBridge = locator
.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
logger.trace("Finished setting up Guice bridge {}", container);
logger.trace("Starting up catalogue synchroniser");
backgroundSync = injector.getInstance(BackgroundSync.class);
backgroundSync.start();
logger.trace("Started up catalogue synchroniser");
}
示例10: Hk2GuiceBridgeFeature
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public Hk2GuiceBridgeFeature(final ServiceLocator serviceLocator) {
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
final GuiceIntoHK2Bridge g2h = serviceLocator.getService(GuiceIntoHK2Bridge.class);
final Injector injector = Guice.createInjector(new AppModule());
g2h.bridgeGuiceInjector(injector);
}
示例11: createBiDirectionalGuiceBridge
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
private Injector createBiDirectionalGuiceBridge(ServiceLocator serviceLocator) {
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
Injector injector = RestApiServerImpl.injector;
GuiceIntoHK2Bridge g2h = serviceLocator.getService(GuiceIntoHK2Bridge.class);
g2h.bridgeGuiceInjector(injector);
return injector;
}
示例12: configure
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
ServiceLocator serviceLocator = ServiceLocatorProvider.getServiceLocator(context);
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
return true;
}
示例13: WidowAnalyzeResourceConfig
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public WidowAnalyzeResourceConfig(ServiceLocator serviceLocator) {
// Set package to look for resources in
packages("com.widowcrawler.analyze");
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(WidowAnalyzeServletContextListener.getCachedInjector());
}
示例14: Application
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Inject
public Application(ServiceLocator serviceLocator) {
packages(true, "ar.com.jengibre");
// guice
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(Guice.createInjector(new GuiceModule()));
}
示例15: configure
import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge; //导入方法依赖的package包/类
@Override
public boolean configure(FeatureContext context) {
ServiceLocator serviceLocator = ServiceLocatorProvider.getServiceLocator( context );
GuiceBridge.getGuiceBridge().initializeGuiceBridge( serviceLocator );
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService( GuiceIntoHK2Bridge.class );
guiceBridge.bridgeGuiceInjector( StartupListener.INJECTOR );
return true;
}