Java Code Examples for org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge#bridgeGuiceInjector()
The following examples show how to use
org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge#bridgeGuiceInjector() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JerseyApplication.java From onedev with MIT License | 6 votes |
@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(JacksonFeature.class); packages(JerseyApplication.class.getPackage().getName()); for (JerseyConfigurator configurator: AppLoader.getExtensions(JerseyConfigurator.class)) { configurator.configure(this); } }
Example 2
Source File: GuiceFeature.java From jrestless-examples with Apache License 2.0 | 6 votes |
@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; }
Example 3
Source File: MCRGuiceBridgeFeature.java From mycore with GNU General Public License v3.0 | 5 votes |
@Override public boolean configure(FeatureContext context) { Objects.requireNonNull(scopedLocator, "HK2 ServiceLocator was not injected"); Injector injector = MCRInjectorConfig.injector(); GuiceBridge.getGuiceBridge().initializeGuiceBridge(scopedLocator); GuiceIntoHK2Bridge guiceBridge = scopedLocator.getService(GuiceIntoHK2Bridge.class); guiceBridge.bridgeGuiceInjector(injector); LogManager.getLogger().info("Initialize hk2 - guice bridge...done"); return true; }
Example 4
Source File: GuiceBridgeActivator.java From dropwizard-guicey with MIT License | 5 votes |
/** * Activate HK2 guice bridge. */ public void activate() { final ServiceLocator locator = injectionManager.getInstance(ServiceLocator.class); GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator); final GuiceIntoHK2Bridge guiceBridge = injectionManager.getInstance(GuiceIntoHK2Bridge.class); guiceBridge.bridgeGuiceInjector(injector); }
Example 5
Source File: GuiceFeature.java From usergrid with Apache License 2.0 | 5 votes |
@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; }