use of org.glassfish.jersey.server.spi.AbstractContainerLifecycleListener in project jersey by jersey.
the class ReloadTest method configure.
@Override
protected ResourceConfig configure() {
enable(TestProperties.LOG_TRAFFIC);
final ResourceConfig result = new ResourceConfig(ArrivalsResource.class);
result.registerInstances(new AbstractContainerLifecycleListener() {
@Override
public void onStartup(Container container) {
ReloadTest.container = container;
}
});
return result;
}
use of org.glassfish.jersey.server.spi.AbstractContainerLifecycleListener in project mycore by MyCoRe-Org.
the class MCRJerseyDefaultConfiguration method setupGuiceBridge.
/**
* Adds the binding between guice and hk2. This binding is one directional.
* You can add guice services into hk2 (jersey) resources. You cannot add
* a hk2 service into guice.
* <p>
* <a href="https://hk2.java.net/guice-bridge/">about the bridge</a>
* </p>
*
* @param resourceConfig the jersey resource configuration
*/
protected void setupGuiceBridge(ResourceConfig resourceConfig) {
LogManager.getLogger().info("Initialize hk2 - guice bridge...");
resourceConfig.register(new AbstractContainerLifecycleListener() {
@Override
public void onStartup(Container container) {
ServiceLocator serviceLocator = container.getApplicationHandler().getServiceLocator();
Injector injector = MCRInjectorConfig.injector();
GuiceBridge.getGuiceBridge().initializeGuiceBridge(serviceLocator);
GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService(GuiceIntoHK2Bridge.class);
guiceBridge.bridgeGuiceInjector(injector);
}
});
}
Aggregations