private void prepareHabitat() { // Bootstrap a hk2 environment. ModulesRegistry registry = new StaticModulesRegistry(getClass().getClassLoader()); habitat = registry.createHabitat("default"); StartupContext startupContext = new StartupContext(); habitat.add(new ExistingSingletonInhabitant(startupContext)); habitat.addComponent(null, new ProcessEnvironment(ProcessEnvironment.ProcessType.Other)); }
private void prepareHabitat() { ModulesRegistry registry = new StaticModulesRegistry(getClass().getClassLoader()); ServiceLocator serviceLocator = registry.createServiceLocator("default"); habitat = serviceLocator.getService(ServiceLocator.class); StartupContext startupContext = new StartupContext(); ServiceLocatorUtilities.addOneConstant(habitat, startupContext); ServiceLocatorUtilities.addOneConstant(habitat, new ProcessEnvironment(ProcessEnvironment.ProcessType.Other)); }
static private Habitat getHabitat() { Habitat habitat = Globals.getStaticHabitat(); StartupContext startupContext = new StartupContext(); habitat.add(new ExistingSingletonInhabitant(startupContext)); habitat.addComponent(null, new ProcessEnvironment(ProcessEnvironment.ProcessType.Other)); return habitat; } }
new ProcessEnvironment(ProcessEnvironment.ProcessType.Embedded): new ProcessEnvironment(ProcessEnvironment.ProcessType.Server))); config.commit();